[Swfdec-commits] 15 commits - configure.ac doc/Makefile.am doc/swfdec.types libswfdec/compiler.c libswfdec/.gitignore libswfdec-gtk/.gitignore libswfdec-gtk/Makefile.am libswfdec-gtk/swfdec-gtk.h libswfdec-gtk/swfdec_gtk_keys.c libswfdec-gtk/swfdec_gtk_keys.h libswfdec-gtk/swfdec_gtk_loader.c libswfdec-gtk/swfdec_gtk_loader.h libswfdec-gtk/swfdec_gtk_player.c libswfdec-gtk/swfdec_gtk_player.h libswfdec-gtk/swfdec_gtk_socket.c libswfdec-gtk/swfdec_gtk_socket.h libswfdec-gtk/swfdec_gtk_widget.c libswfdec-gtk/swfdec_gtk_widget.h libswfdec-gtk/swfdec_playback_alsa.c libswfdec-gtk/swfdec_playback.h libswfdec-gtk/swfdec_playback_none.c libswfdec-gtk/swfdec_playback_oss.c libswfdec-gtk/swfdec_playback_pa.c libswfdec-gtk/swfdec_source.c libswfdec-gtk/swfdec_source.h libswfdec/jpeg libswfdec/Makefile.am libswfdec/swfdec_accessibility.c libswfdec/swfdec_amf.c libswfdec/swfdec_amf.h libswfdec/swfdec_as_array.c libswfdec/swfdec_as_array.h libswfdec/swfdec_as_boolean.c libswfdec/swfdec_as_boolean.h libswfdec/swfdec_asbroadcaster.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_date.c libswfdec/swfdec_as_date.h libswfdec/swfdec_as_debugger.c libswfdec/swfdec_as_debugger.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_frame_internal.h libswfdec/swfdec_as_function.c libswfdec/swfdec_as_function.h libswfdec/swfdec_as_initialize.as libswfdec/swfdec_as_initialize.h libswfdec/swfdec_as_internal.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_interpret.h libswfdec/swfdec_as_math.c libswfdec/swfdec_as_native_function.c libswfdec/swfdec_as_native_function.h libswfdec/swfdec_as_number.c libswfdec/swfdec_as_number.h libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_script_function.c libswfdec/swfdec_as_script_function.h libswfdec/swfdec_as_stack.c libswfdec/swfdec_as_stack.h libswfdec/swfdec_as_string.c libswfdec/swfdec_as_string.h libswfdec/swfdec_as_strings.c libswfdec/swfdec_as_super.c libswfdec/swfdec_as_super.h libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h libswfdec/swfdec_audio.c libswfdec/swfdec_audio_event.c libswfdec/swfdec_audio_event.h libswfdec/swfdec_audio_flv.c libswfdec/swfdec_audio_flv.h libswfdec/swfdec_audio.h libswfdec/swfdec_audio_internal.h libswfdec/swfdec_audio_stream.c libswfdec/swfdec_audio_stream.h libswfdec/swfdec_bevel_filter.c libswfdec/swfdec_bitmap_data.c libswfdec/swfdec_bitmap_filter.c libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_blur_filter.c libswfdec/swfdec_buffer.c libswfdec/swfdec_buffer.h libswfdec/swfdec_button.c libswfdec/swfdec_button.h libswfdec/swfdec_button_movie_as.c libswfdec/swfdec_button_movie.c libswfdec/swfdec_button_movie.h libswfdec/swfdec_cache.c libswfdec/swfdec_cached.c libswfdec/swfdec_cached.h libswfdec/swfdec_cache.h libswfdec/swfdec_camera.c libswfdec/swfdec_character.c libswfdec/swfdec_character.h libswfdec/swfdec_codec_adpcm.c libswfdec/swfdec_codec_audio.c libswfdec/swfdec_codec_audio.h libswfdec/swfdec_codec_ffmpeg.c libswfdec/swfdec_codec_gst.c libswfdec/swfdec_codec_mad.c libswfdec/swfdec_codec_screen.c libswfdec/swfdec_codec_video.c libswfdec/swfdec_codec_video.h libswfdec/swfdec_codec_vp6_alpha.c libswfdec/swfdec_color_as.c libswfdec/swfdec_color.c libswfdec/swfdec_color.h libswfdec/swfdec_color_matrix_filter.c libswfdec/swfdec_color_transform.c libswfdec/swfdec_convolution_filter.c libswfdec/swfdec_debug.c libswfdec/swfdec_debugger.c libswfdec/swfdec_debugger.h libswfdec/swfdec_debug.h libswfdec/swfdec_decoder.c libswfdec/swfdec_decoder.h libswfdec/swfdec_displacement_map_filter.c libswfdec/swfdec_draw.c libswfdec/swfdec_draw.h libswfdec/swfdec_drop_shadow_filter.c libswfdec/swfdec_event.c libswfdec/swfdec_event.h libswfdec/swfdec_external_interface.c libswfdec/swfdec_file_loader.c libswfdec/swfdec_file_loader.h libswfdec/swfdec_file_reference.c libswfdec/swfdec_file_reference_list.c libswfdec/swfdec_filter_as.c libswfdec/swfdec_filter.c libswfdec/swfdec_filter.h libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_flv_decoder.h libswfdec/swfdec_font.c libswfdec/swfdec_font.h libswfdec/swfdec_function_list.c libswfdec/swfdec_function_list.h libswfdec/swfdec_glow_filter.c libswfdec/swfdec_gradient_filter.c libswfdec/swfdec_gradient_pattern.c libswfdec/swfdec_gradient_pattern.h libswfdec/swfdec_graphic.c libswfdec/swfdec_graphic.h libswfdec/swfdec_graphic_movie.c libswfdec/swfdec_graphic_movie.h libswfdec/swfdec.h libswfdec/swfdec_image.c libswfdec/swfdec_image_decoder.c libswfdec/swfdec_image_decoder.h libswfdec/swfdec_image.h libswfdec/swfdec_initialize.as libswfdec/swfdec_initialize.h libswfdec/swfdec_internal.h libswfdec/swfdec_interval.c libswfdec/swfdec_interval.h libswfdec/swfdec_key_as.c libswfdec/swfdec_keys.h libswfdec/swfdec_loader.c libswfdec/swfdec_loader.h libswfdec/swfdec_loader_internal.h libswfdec/swfdec_load_object_as.c libswfdec/swfdec_load_object.c libswfdec/swfdec_load_object.h libswfdec/swfdec_loadvars_as.c libswfdec/swfdec_local_connection.c libswfdec/swfdec_marshal.list libswfdec/swfdec_microphone.c libswfdec/swfdec_morph_movie.c libswfdec/swfdec_morph_movie.h libswfdec/swfdec_morphshape.c libswfdec/swfdec_morphshape.h libswfdec/swfdec_mouse_as.c libswfdec/swfdec_movie_as_drawing.c libswfdec/swfdec_movie_asprops.c libswfdec/swfdec_movie.c libswfdec/swfdec_movie_clip_loader.c libswfdec/swfdec_movie_clip_loader.h libswfdec/swfdec_movie.h libswfdec/swfdec_net_connection.c libswfdec/swfdec_net_connection.h libswfdec/swfdec_net_stream_as.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_net_stream.h libswfdec/swfdec_path.c libswfdec/swfdec_path.h libswfdec/swfdec_pattern.c libswfdec/swfdec_pattern.h libswfdec/swfdec_player_as.c libswfdec/swfdec_player.c libswfdec/swfdec_player.h libswfdec/swfdec_player_internal.h libswfdec/swfdec_player_scripting.c libswfdec/swfdec_player_scripting.h libswfdec/swfdec_policy_file.c libswfdec/swfdec_policy_file.h libswfdec/swfdec_print_job.c libswfdec/swfdec_rectangle.c libswfdec/swfdec_rectangle.h libswfdec/swfdec_rect.c libswfdec/swfdec_rect.h libswfdec/swfdec_resource.c libswfdec/swfdec_resource.h libswfdec/swfdec_ringbuffer.c libswfdec/swfdec_ringbuffer.h libswfdec/swfdec_sandbox.c libswfdec/swfdec_sandbox.h libswfdec/swfdec_script.c libswfdec/swfdec_script.h libswfdec/swfdec_script_internal.h libswfdec/swfdec_selection.c libswfdec/swfdec_shape.c libswfdec/swfdec_shape.h libswfdec/swfdec_shape_parser.c libswfdec/swfdec_shape_parser.h libswfdec/swfdec_shared_object.c libswfdec/swfdec_socket.c libswfdec/swfdec_socket.h libswfdec/swfdec_sound.c libswfdec/swfdec_sound.h libswfdec/swfdec_sound_object.c libswfdec/swfdec_sound_object.h libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite.h libswfdec/swfdec_sprite_movie_as.c libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_sprite_movie.h libswfdec/swfdec_stage_as.c libswfdec/swfdec_stream.c libswfdec/swfdec_stream.h libswfdec/swfdec_stream_target.c libswfdec/swfdec_stream_target.h libswfdec/swfdec_stroke.c libswfdec/swfdec_stroke.h libswfdec/swfdec_style_sheet.c libswfdec/swfdec_style_sheet.h libswfdec/swfdec_swf_decoder.c libswfdec/swfdec_swf_decoder.h libswfdec/swfdec_system_as.c libswfdec/swfdec_system.c libswfdec/swfdec_system.h libswfdec/swfdec_system_ime.c libswfdec/swfdec_system_security.c libswfdec/swfdec_tag.c libswfdec/swfdec_tag.h libswfdec/swfdec_text.c libswfdec/swfdec_text_field.c libswfdec/swfdec_text_field.h libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c libswfdec/swfdec_text_field_movie.h libswfdec/swfdec_text_field_movie_html.c libswfdec/swfdec_text_format.c libswfdec/swfdec_text_format.h libswfdec/swfdec_text.h libswfdec/swfdec_text_renderer.c libswfdec/swfdec_text_snapshot.c libswfdec/swfdec_transform.c libswfdec/swfdec_types.h libswfdec/swfdec_url.c libswfdec/swfdec_url.h libswfdec/swfdec_utils.c libswfdec/swfdec_utils.h libswfdec/swfdec_video.c libswfdec/swfdec_video.h libswfdec/swfdec_video_movie_as.c libswfdec/swfdec_video_movie.c libswfdec/swfdec_video_movie.h libswfdec/swfdec_xml.c libswfdec/swfdec_xml.h libswfdec/swfdec_xml_node.c libswfdec/swfdec_xml_node.h libswfdec/swfdec_xml_socket.c libswfdec/swfdec_xml_socket.h Makefile.am player/swfdec_debug_script.h player/swfdec_debug_scripts.c player/swfdec_debug_scripts.h player/swfdec_debug_stack.c player/swfdec_player_manager.c player/swfdec_player_manager.h player/swfplay.c README swfdec/compiler.c swfdec/.gitignore swfdec-gtk/.gitignore swfdec-gtk/Makefile.am swfdec-gtk/swfdec-gtk.h swfdec-gtk/swfdec_gtk_keys.c swfdec-gtk/swfdec_gtk_keys.h swfdec-gtk/swfdec_gtk_loader.c swfdec-gtk/swfdec_gtk_loader.h swfdec-gtk/swfdec_gtk_player.c swfdec-gtk/swfdec_gtk_player.h swfdec-gtk/swfdec_gtk_socket.c swfdec-gtk/swfdec_gtk_socket.h swfdec-gtk/swfdec_gtk_widget.c swfdec-gtk/swfdec_gtk_widget.h swfdec-gtk/swfdec_playback_alsa.c swfdec-gtk/swfdec_playback.h swfdec-gtk/swfdec_playback_none.c swfdec-gtk/swfdec_playback_oss.c swfdec-gtk/swfdec_playback_pa.c swfdec-gtk/swfdec_source.c swfdec-gtk/swfdec_source.h swfdec/jpeg swfdec/Makefile.am swfdec/swfdec_accessibility.c swfdec/swfdec_amf.c swfdec/swfdec_amf.h swfdec/swfdec_as_array.c swfdec/swfdec_as_array.h swfdec/swfdec_as_boolean.c swfdec/swfdec_as_boolean.h swfdec/swfdec_asbroadcaster.c swfdec/swfdec_as_context.c swfdec/swfdec_as_context.h swfdec/swfdec_as_date.c swfdec/swfdec_as_date.h swfdec/swfdec_as_debugger.c swfdec/swfdec_as_debugger.h swfdec/swfdec_as_frame.c swfdec/swfdec_as_frame.h swfdec/swfdec_as_frame_internal.h swfdec/swfdec_as_function.c swfdec/swfdec_as_function.h swfdec/swfdec_as_initialize.as swfdec/swfdec_as_initialize.h swfdec/swfdec_as_internal.h swfdec/swfdec_as_interpret.c swfdec/swfdec_as_interpret.h swfdec/swfdec_as_math.c swfdec/swfdec_as_native_function.c swfdec/swfdec_as_native_function.h swfdec/swfdec_as_number.c swfdec/swfdec_as_number.h swfdec/swfdec_as_object.c swfdec/swfdec_as_object.h swfdec/swfdec_as_script_function.c swfdec/swfdec_as_script_function.h swfdec/swfdec_as_stack.c swfdec/swfdec_as_stack.h swfdec/swfdec_as_string.c swfdec/swfdec_as_string.h swfdec/swfdec_as_strings.c swfdec/swfdec_as_super.c swfdec/swfdec_as_super.h swfdec/swfdec_as_types.c swfdec/swfdec_as_types.h swfdec/swfdec_audio.c swfdec/swfdec_audio_event.c swfdec/swfdec_audio_event.h swfdec/swfdec_audio_flv.c swfdec/swfdec_audio_flv.h swfdec/swfdec_audio.h swfdec/swfdec_audio_internal.h swfdec/swfdec_audio_stream.c swfdec/swfdec_audio_stream.h swfdec/swfdec_bevel_filter.c swfdec/swfdec_bitmap_data.c swfdec/swfdec_bitmap_filter.c swfdec/swfdec_bits.c swfdec/swfdec_bits.h swfdec/swfdec_blur_filter.c swfdec/swfdec_buffer.c swfdec/swfdec_buffer.h swfdec/swfdec_button.c swfdec/swfdec_button.h swfdec/swfdec_button_movie_as.c swfdec/swfdec_button_movie.c swfdec/swfdec_button_movie.h swfdec/swfdec_cache.c swfdec/swfdec_cached.c swfdec/swfdec_cached.h swfdec/swfdec_cache.h swfdec/swfdec_camera.c swfdec/swfdec_character.c swfdec/swfdec_character.h swfdec/swfdec_codec_adpcm.c swfdec/swfdec_codec_audio.c swfdec/swfdec_codec_audio.h swfdec/swfdec_codec_ffmpeg.c swfdec/swfdec_codec_gst.c swfdec/swfdec_codec_mad.c swfdec/swfdec_codec_screen.c swfdec/swfdec_codec_video.c swfdec/swfdec_codec_video.h swfdec/swfdec_codec_vp6_alpha.c swfdec/swfdec_color_as.c swfdec/swfdec_color.c swfdec/swfdec_color.h swfdec/swfdec_color_matrix_filter.c swfdec/swfdec_color_transform.c swfdec/swfdec_convolution_filter.c swfdec/swfdec_debug.c swfdec/swfdec_debugger.c swfdec/swfdec_debugger.h swfdec/swfdec_debug.h swfdec/swfdec_decoder.c swfdec/swfdec_decoder.h swfdec/swfdec_displacement_map_filter.c swfdec/swfdec_draw.c swfdec/swfdec_draw.h swfdec/swfdec_drop_shadow_filter.c swfdec/swfdec_event.c swfdec/swfdec_event.h swfdec/swfdec_external_interface.c swfdec/swfdec_file_loader.c swfdec/swfdec_file_loader.h swfdec/swfdec_file_reference.c swfdec/swfdec_file_reference_list.c swfdec/swfdec_filter_as.c swfdec/swfdec_filter.c swfdec/swfdec_filter.h swfdec/swfdec_flv_decoder.c swfdec/swfdec_flv_decoder.h swfdec/swfdec_font.c swfdec/swfdec_font.h swfdec/swfdec_function_list.c swfdec/swfdec_function_list.h swfdec/swfdec_glow_filter.c swfdec/swfdec_gradient_filter.c swfdec/swfdec_gradient_pattern.c swfdec/swfdec_gradient_pattern.h swfdec/swfdec_graphic.c swfdec/swfdec_graphic.h swfdec/swfdec_graphic_movie.c swfdec/swfdec_graphic_movie.h swfdec/swfdec.h swfdec/swfdec_image.c swfdec/swfdec_image_decoder.c swfdec/swfdec_image_decoder.h swfdec/swfdec_image.h swfdec/swfdec_initialize.as swfdec/swfdec_initialize.h swfdec/swfdec_internal.h swfdec/swfdec_interval.c swfdec/swfdec_interval.h swfdec/swfdec_key_as.c swfdec/swfdec_keys.h swfdec/swfdec_loader.c swfdec/swfdec_loader.h swfdec/swfdec_loader_internal.h swfdec/swfdec_load_object_as.c swfdec/swfdec_load_object.c swfdec/swfdec_load_object.h swfdec/swfdec_loadvars_as.c swfdec/swfdec_local_connection.c swfdec/swfdec_marshal.list swfdec/swfdec_microphone.c swfdec/swfdec_morph_movie.c swfdec/swfdec_morph_movie.h swfdec/swfdec_morphshape.c swfdec/swfdec_morphshape.h swfdec/swfdec_mouse_as.c swfdec/swfdec_movie_as_drawing.c swfdec/swfdec_movie_asprops.c swfdec/swfdec_movie.c swfdec/swfdec_movie_clip_loader.c swfdec/swfdec_movie_clip_loader.h swfdec/swfdec_movie.h swfdec/swfdec_net_connection.c swfdec/swfdec_net_connection.h swfdec/swfdec_net_stream_as.c swfdec/swfdec_net_stream.c swfdec/swfdec_net_stream.h swfdec/swfdec_path.c swfdec/swfdec_path.h swfdec/swfdec_pattern.c swfdec/swfdec_pattern.h swfdec/swfdec_player_as.c swfdec/swfdec_player.c swfdec/swfdec_player.h swfdec/swfdec_player_internal.h swfdec/swfdec_player_scripting.c swfdec/swfdec_player_scripting.h swfdec/swfdec_policy_file.c swfdec/swfdec_policy_file.h swfdec/swfdec_print_job.c swfdec/swfdec_rectangle.c swfdec/swfdec_rectangle.h swfdec/swfdec_rect.c swfdec/swfdec_rect.h swfdec/swfdec_resource.c swfdec/swfdec_resource.h swfdec/swfdec_ringbuffer.c swfdec/swfdec_ringbuffer.h swfdec/swfdec_sandbox.c swfdec/swfdec_sandbox.h swfdec/swfdec_script.c swfdec/swfdec_script.h swfdec/swfdec_script_internal.h swfdec/swfdec_selection.c swfdec/swfdec_shape.c swfdec/swfdec_shape.h swfdec/swfdec_shape_parser.c swfdec/swfdec_shape_parser.h swfdec/swfdec_shared_object.c swfdec/swfdec_socket.c swfdec/swfdec_socket.h swfdec/swfdec_sound.c swfdec/swfdec_sound.h swfdec/swfdec_sound_object.c swfdec/swfdec_sound_object.h swfdec/swfdec_sprite.c swfdec/swfdec_sprite.h swfdec/swfdec_sprite_movie_as.c swfdec/swfdec_sprite_movie.c swfdec/swfdec_sprite_movie.h swfdec/swfdec_stage_as.c swfdec/swfdec_stream.c swfdec/swfdec_stream.h swfdec/swfdec_stream_target.c swfdec/swfdec_stream_target.h swfdec/swfdec_stroke.c swfdec/swfdec_stroke.h swfdec/swfdec_style_sheet.c swfdec/swfdec_style_sheet.h swfdec/swfdec_swf_decoder.c swfdec/swfdec_swf_decoder.h swfdec/swfdec_system_as.c swfdec/swfdec_system.c swfdec/swfdec_system.h swfdec/swfdec_system_ime.c swfdec/swfdec_system_security.c swfdec/swfdec_tag.c swfdec/swfdec_tag.h swfdec/swfdec_text.c swfdec/swfdec_text_field.c swfdec/swfdec_text_field.h swfdec/swfdec_text_field_movie_as.c swfdec/swfdec_text_field_movie.c swfdec/swfdec_text_field_movie.h swfdec/swfdec_text_field_movie_html.c swfdec/swfdec_text_format.c swfdec/swfdec_text_format.h swfdec/swfdec_text.h swfdec/swfdec_text_renderer.c swfdec/swfdec_text_snapshot.c swfdec/swfdec_transform.c swfdec/swfdec_types.h swfdec/swfdec_url.c swfdec/swfdec_url.h swfdec/swfdec_utils.c swfdec/swfdec_utils.h swfdec/swfdec_video.c swfdec/swfdec_video.h swfdec/swfdec_video_movie_as.c swfdec/swfdec_video_movie.c swfdec/swfdec_video_movie.h swfdec/swfdec_xml.c swfdec/swfdec_xml.h swfdec/swfdec_xml_node.c swfdec/swfdec_xml_node.h swfdec/swfdec_xml_socket.c swfdec/swfdec_xml_socket.h test/rtmp test/sound test/swfdec_test.c test/swfdec_test_function.h test/swfdec_test_global.c test/swfdec_test_image.h test/swfdec_test_test.c test/swfdec_test_test.h test/various tools/crashfinder.c tools/dump.c tools/swfdec-extract.c tools/swfdec_out.h tools/swfedit_file.c tools/swfedit_file.h tools/swfedit_tag.c tools/swfedit_tag.h tools/swfedit_token.c tools/swfedit_token.h tools/swfscript.c vivified/core vivified/ui
Benjamin Otte
company at kemper.freedesktop.org
Fri Jan 25 09:37:07 PST 2008
Makefile.am | 4
README | 10
configure.ac | 14
doc/Makefile.am | 16
doc/swfdec.types | 4
libswfdec-gtk/.gitignore | 14
libswfdec-gtk/Makefile.am | 45
libswfdec-gtk/swfdec-gtk.h | 29
libswfdec-gtk/swfdec_gtk_keys.c | 77
libswfdec-gtk/swfdec_gtk_keys.h | 30
libswfdec-gtk/swfdec_gtk_loader.c | 230 --
libswfdec-gtk/swfdec_gtk_loader.h | 44
libswfdec-gtk/swfdec_gtk_player.c | 343 ---
libswfdec-gtk/swfdec_gtk_player.h | 57
libswfdec-gtk/swfdec_gtk_socket.c | 220 -
libswfdec-gtk/swfdec_gtk_socket.h | 42
libswfdec-gtk/swfdec_gtk_widget.c | 683 ------
libswfdec-gtk/swfdec_gtk_widget.h | 69
libswfdec-gtk/swfdec_playback.h | 35
libswfdec-gtk/swfdec_playback_alsa.c | 360 ---
libswfdec-gtk/swfdec_playback_none.c | 38
libswfdec-gtk/swfdec_playback_oss.c | 265 --
libswfdec-gtk/swfdec_playback_pa.c | 350 ---
libswfdec-gtk/swfdec_source.c | 183 -
libswfdec-gtk/swfdec_source.h | 34
libswfdec/.gitignore | 19
libswfdec/Makefile.am | 372 ---
libswfdec/compiler.c | 92
libswfdec/jpeg/.gitignore | 14
libswfdec/jpeg/Makefile.am | 20
libswfdec/jpeg/cogcompat.h | 14
libswfdec/jpeg/jpeg.c | 1126 ---------
libswfdec/jpeg/jpeg.h | 190 -
libswfdec/jpeg/jpeg_bits.c | 154 -
libswfdec/jpeg/jpeg_bits.h | 32
libswfdec/jpeg/jpeg_huffman.c | 168 -
libswfdec/jpeg/jpeg_huffman.h | 37
libswfdec/jpeg/jpeg_markers.h | 44
libswfdec/jpeg/jpeg_rgb_decoder.c | 352 ---
libswfdec/jpeg/jpeg_rgb_decoder.h | 18
libswfdec/jpeg/jpeg_tables.c | 54
libswfdec/swfdec.h | 48
libswfdec/swfdec_accessibility.c | 50
libswfdec/swfdec_amf.c | 225 -
libswfdec/swfdec_amf.h | 59
libswfdec/swfdec_as_array.c | 1399 ------------
libswfdec/swfdec_as_array.h | 84
libswfdec/swfdec_as_boolean.c | 103
libswfdec/swfdec_as_boolean.h | 52
libswfdec/swfdec_as_context.c | 1461 ------------
libswfdec/swfdec_as_context.h | 143 -
libswfdec/swfdec_as_date.c | 1162 ----------
libswfdec/swfdec_as_date.h | 60
libswfdec/swfdec_as_debugger.c | 82
libswfdec/swfdec_as_debugger.h | 80
libswfdec/swfdec_as_frame.c | 895 -------
libswfdec/swfdec_as_frame.h | 63
libswfdec/swfdec_as_frame_internal.h | 106
libswfdec/swfdec_as_function.c | 279 --
libswfdec/swfdec_as_function.h | 61
libswfdec/swfdec_as_initialize.as | 100
libswfdec/swfdec_as_initialize.h | 175 -
libswfdec/swfdec_as_internal.h | 78
libswfdec/swfdec_as_interpret.c | 3268 -----------------------------
libswfdec/swfdec_as_interpret.h | 150 -
libswfdec/swfdec_as_math.c | 149 -
libswfdec/swfdec_as_native_function.c | 395 ---
libswfdec/swfdec_as_native_function.h | 95
libswfdec/swfdec_as_number.c | 121 -
libswfdec/swfdec_as_number.h | 52
libswfdec/swfdec_as_object.c | 1773 ---------------
libswfdec/swfdec_as_object.h | 190 -
libswfdec/swfdec_as_script_function.c | 154 -
libswfdec/swfdec_as_script_function.h | 61
libswfdec/swfdec_as_stack.c | 200 -
libswfdec/swfdec_as_stack.h | 101
libswfdec/swfdec_as_string.c | 914 --------
libswfdec/swfdec_as_string.h | 62
libswfdec/swfdec_as_strings.c | 491 ----
libswfdec/swfdec_as_super.c | 217 -
libswfdec/swfdec_as_super.h | 59
libswfdec/swfdec_as_types.c | 677 ------
libswfdec/swfdec_as_types.h | 139 -
libswfdec/swfdec_asbroadcaster.c | 84
libswfdec/swfdec_audio.c | 346 ---
libswfdec/swfdec_audio.h | 47
libswfdec/swfdec_audio_event.c | 330 --
libswfdec/swfdec_audio_event.h | 74
libswfdec/swfdec_audio_flv.c | 227 --
libswfdec/swfdec_audio_flv.h | 66
libswfdec/swfdec_audio_internal.h | 77
libswfdec/swfdec_audio_stream.c | 205 -
libswfdec/swfdec_audio_stream.h | 65
libswfdec/swfdec_bevel_filter.c | 226 --
libswfdec/swfdec_bitmap_data.c | 306 --
libswfdec/swfdec_bitmap_filter.c | 43
libswfdec/swfdec_bits.c | 760 ------
libswfdec/swfdec_bits.h | 75
libswfdec/swfdec_blur_filter.c | 82
libswfdec/swfdec_buffer.c | 641 -----
libswfdec/swfdec_buffer.h | 85
libswfdec/swfdec_button.c | 302 --
libswfdec/swfdec_button.h | 83
libswfdec/swfdec_button_movie.c | 320 --
libswfdec/swfdec_button_movie.h | 54
libswfdec/swfdec_button_movie_as.c | 108
libswfdec/swfdec_cache.c | 164 -
libswfdec/swfdec_cache.h | 63
libswfdec/swfdec_cached.c | 123 -
libswfdec/swfdec_cached.h | 65
libswfdec/swfdec_camera.c | 89
libswfdec/swfdec_character.c | 42
libswfdec/swfdec_character.h | 62
libswfdec/swfdec_codec_adpcm.c | 186 -
libswfdec/swfdec_codec_audio.c | 284 --
libswfdec/swfdec_codec_audio.h | 57
libswfdec/swfdec_codec_ffmpeg.c | 317 --
libswfdec/swfdec_codec_gst.c | 615 -----
libswfdec/swfdec_codec_mad.c | 235 --
libswfdec/swfdec_codec_screen.c | 134 -
libswfdec/swfdec_codec_video.c | 320 --
libswfdec/swfdec_codec_video.h | 75
libswfdec/swfdec_codec_vp6_alpha.c | 111
libswfdec/swfdec_color.c | 299 --
libswfdec/swfdec_color.h | 75
libswfdec/swfdec_color_as.c | 181 -
libswfdec/swfdec_color_matrix_filter.c | 53
libswfdec/swfdec_color_transform.c | 206 -
libswfdec/swfdec_convolution_filter.c | 197 -
libswfdec/swfdec_debug.c | 78
libswfdec/swfdec_debug.h | 65
libswfdec/swfdec_debugger.c | 617 -----
libswfdec/swfdec_debugger.h | 108
libswfdec/swfdec_decoder.c | 103
libswfdec/swfdec_decoder.h | 92
libswfdec/swfdec_displacement_map_filter.c | 197 -
libswfdec/swfdec_draw.c | 190 -
libswfdec/swfdec_draw.h | 85
libswfdec/swfdec_drop_shadow_filter.c | 233 --
libswfdec/swfdec_event.c | 231 --
libswfdec/swfdec_event.h | 77
libswfdec/swfdec_external_interface.c | 228 --
libswfdec/swfdec_file_loader.c | 137 -
libswfdec/swfdec_file_loader.h | 53
libswfdec/swfdec_file_reference.c | 139 -
libswfdec/swfdec_file_reference_list.c | 33
libswfdec/swfdec_filter.c | 124 -
libswfdec/swfdec_filter.h | 60
libswfdec/swfdec_filter_as.c | 47
libswfdec/swfdec_flv_decoder.c | 595 -----
libswfdec/swfdec_flv_decoder.h | 83
libswfdec/swfdec_font.c | 457 ----
libswfdec/swfdec_font.h | 89
libswfdec/swfdec_function_list.c | 132 -
libswfdec/swfdec_function_list.h | 50
libswfdec/swfdec_glow_filter.c | 162 -
libswfdec/swfdec_gradient_filter.c | 243 --
libswfdec/swfdec_gradient_pattern.c | 129 -
libswfdec/swfdec_gradient_pattern.h | 67
libswfdec/swfdec_graphic.c | 71
libswfdec/swfdec_graphic.h | 78
libswfdec/swfdec_graphic_movie.c | 113 -
libswfdec/swfdec_graphic_movie.h | 51
libswfdec/swfdec_image.c | 710 ------
libswfdec/swfdec_image.h | 84
libswfdec/swfdec_image_decoder.c | 131 -
libswfdec/swfdec_image_decoder.h | 59
libswfdec/swfdec_initialize.as | 1521 -------------
libswfdec/swfdec_initialize.h | 2196 -------------------
libswfdec/swfdec_internal.h | 68
libswfdec/swfdec_interval.c | 193 -
libswfdec/swfdec_interval.h | 80
libswfdec/swfdec_key_as.c | 83
libswfdec/swfdec_keys.h | 126 -
libswfdec/swfdec_load_object.c | 253 --
libswfdec/swfdec_load_object.h | 76
libswfdec/swfdec_load_object_as.c | 141 -
libswfdec/swfdec_loader.c | 506 ----
libswfdec/swfdec_loader.h | 97
libswfdec/swfdec_loader_internal.h | 51
libswfdec/swfdec_loadvars_as.c | 46
libswfdec/swfdec_local_connection.c | 57
libswfdec/swfdec_marshal.list | 6
libswfdec/swfdec_microphone.c | 74
libswfdec/swfdec_morph_movie.c | 133 -
libswfdec/swfdec_morph_movie.h | 54
libswfdec/swfdec_morphshape.c | 96
libswfdec/swfdec_morphshape.h | 53
libswfdec/swfdec_mouse_as.c | 51
libswfdec/swfdec_movie.c | 1815 ----------------
libswfdec/swfdec_movie.h | 306 --
libswfdec/swfdec_movie_as_drawing.c | 456 ----
libswfdec/swfdec_movie_asprops.c | 484 ----
libswfdec/swfdec_movie_clip_loader.c | 127 -
libswfdec/swfdec_movie_clip_loader.h | 51
libswfdec/swfdec_net_connection.c | 186 -
libswfdec/swfdec_net_connection.h | 57
libswfdec/swfdec_net_stream.c | 644 -----
libswfdec/swfdec_net_stream.h | 98
libswfdec/swfdec_net_stream_as.c | 187 -
libswfdec/swfdec_path.c | 273 --
libswfdec/swfdec_path.h | 67
libswfdec/swfdec_pattern.c | 559 ----
libswfdec/swfdec_pattern.h | 75
libswfdec/swfdec_player.c | 2873 -------------------------
libswfdec/swfdec_player.h | 173 -
libswfdec/swfdec_player_as.c | 367 ---
libswfdec/swfdec_player_internal.h | 252 --
libswfdec/swfdec_player_scripting.c | 39
libswfdec/swfdec_player_scripting.h | 62
libswfdec/swfdec_policy_file.c | 350 ---
libswfdec/swfdec_policy_file.h | 65
libswfdec/swfdec_print_job.c | 130 -
libswfdec/swfdec_rect.c | 223 -
libswfdec/swfdec_rect.h | 51
libswfdec/swfdec_rectangle.c | 203 -
libswfdec/swfdec_rectangle.h | 55
libswfdec/swfdec_resource.c | 684 ------
libswfdec/swfdec_resource.h | 98
libswfdec/swfdec_ringbuffer.c | 125 -
libswfdec/swfdec_ringbuffer.h | 59
libswfdec/swfdec_sandbox.c | 303 --
libswfdec/swfdec_sandbox.h | 83
libswfdec/swfdec_script.c | 316 --
libswfdec/swfdec_script.h | 38
libswfdec/swfdec_script_internal.h | 95
libswfdec/swfdec_selection.c | 75
libswfdec/swfdec_shape.c | 387 ---
libswfdec/swfdec_shape.h | 63
libswfdec/swfdec_shape_parser.c | 675 -----
libswfdec/swfdec_shape_parser.h | 48
libswfdec/swfdec_shared_object.c | 82
libswfdec/swfdec_socket.c | 99
libswfdec/swfdec_socket.h | 58
libswfdec/swfdec_sound.c | 558 ----
libswfdec/swfdec_sound.h | 107
libswfdec/swfdec_sound_object.c | 340 ---
libswfdec/swfdec_sound_object.h | 54
libswfdec/swfdec_sprite.c | 217 -
libswfdec/swfdec_sprite.h | 100
libswfdec/swfdec_sprite_movie.c | 883 -------
libswfdec/swfdec_sprite_movie.h | 76
libswfdec/swfdec_sprite_movie_as.c | 891 -------
libswfdec/swfdec_stage_as.c | 246 --
libswfdec/swfdec_stream.c | 399 ---
libswfdec/swfdec_stream.h | 68
libswfdec/swfdec_stream_target.c | 136 -
libswfdec/swfdec_stream_target.h | 67
libswfdec/swfdec_stroke.c | 361 ---
libswfdec/swfdec_stroke.h | 76
libswfdec/swfdec_style_sheet.c | 366 ---
libswfdec/swfdec_style_sheet.h | 57
libswfdec/swfdec_swf_decoder.c | 487 ----
libswfdec/swfdec_swf_decoder.h | 98
libswfdec/swfdec_system.c | 315 --
libswfdec/swfdec_system.h | 76
libswfdec/swfdec_system_as.c | 347 ---
libswfdec/swfdec_system_ime.c | 79
libswfdec/swfdec_system_security.c | 123 -
libswfdec/swfdec_tag.c | 628 -----
libswfdec/swfdec_tag.h | 121 -
libswfdec/swfdec_text.c | 133 -
libswfdec/swfdec_text.h | 67
libswfdec/swfdec_text_field.c | 198 -
libswfdec/swfdec_text_field.h | 93
libswfdec/swfdec_text_field_movie.c | 1627 --------------
libswfdec/swfdec_text_field_movie.h | 160 -
libswfdec/swfdec_text_field_movie_as.c | 1539 -------------
libswfdec/swfdec_text_field_movie_html.c | 777 ------
libswfdec/swfdec_text_format.c | 1274 -----------
libswfdec/swfdec_text_format.h | 101
libswfdec/swfdec_text_renderer.c | 94
libswfdec/swfdec_text_snapshot.c | 109
libswfdec/swfdec_transform.c | 121 -
libswfdec/swfdec_types.h | 63
libswfdec/swfdec_url.c | 553 ----
libswfdec/swfdec_url.h | 65
libswfdec/swfdec_utils.c | 74
libswfdec/swfdec_utils.h | 40
libswfdec/swfdec_video.c | 302 --
libswfdec/swfdec_video.h | 61
libswfdec/swfdec_video_movie.c | 197 -
libswfdec/swfdec_video_movie.h | 77
libswfdec/swfdec_video_movie_as.c | 94
libswfdec/swfdec_xml.c | 940 --------
libswfdec/swfdec_xml.h | 90
libswfdec/swfdec_xml_node.c | 1113 ---------
libswfdec/swfdec_xml_node.h | 103
libswfdec/swfdec_xml_socket.c | 245 --
libswfdec/swfdec_xml_socket.h | 56
player/swfdec_debug_script.h | 2
player/swfdec_debug_scripts.c | 2
player/swfdec_debug_scripts.h | 2
player/swfdec_debug_stack.c | 2
player/swfdec_player_manager.c | 8
player/swfdec_player_manager.h | 4
player/swfplay.c | 52
swfdec-gtk/.gitignore | 14
swfdec-gtk/Makefile.am | 45
swfdec-gtk/swfdec-gtk.h | 29
swfdec-gtk/swfdec_gtk_keys.c | 77
swfdec-gtk/swfdec_gtk_keys.h | 30
swfdec-gtk/swfdec_gtk_loader.c | 215 +
swfdec-gtk/swfdec_gtk_loader.h | 42
swfdec-gtk/swfdec_gtk_player.c | 318 ++
swfdec-gtk/swfdec_gtk_player.h | 69
swfdec-gtk/swfdec_gtk_socket.c | 224 +
swfdec-gtk/swfdec_gtk_socket.h | 42
swfdec-gtk/swfdec_gtk_widget.c | 683 ++++++
swfdec-gtk/swfdec_gtk_widget.h | 69
swfdec-gtk/swfdec_playback.h | 35
swfdec-gtk/swfdec_playback_alsa.c | 360 +++
swfdec-gtk/swfdec_playback_none.c | 38
swfdec-gtk/swfdec_playback_oss.c | 265 ++
swfdec-gtk/swfdec_playback_pa.c | 350 +++
swfdec-gtk/swfdec_source.c | 183 +
swfdec-gtk/swfdec_source.h | 34
swfdec/.gitignore | 19
swfdec/Makefile.am | 373 +++
swfdec/compiler.c | 92
swfdec/jpeg/.gitignore | 14
swfdec/jpeg/Makefile.am | 20
swfdec/jpeg/cogcompat.h | 14
swfdec/jpeg/jpeg.c | 1126 +++++++++
swfdec/jpeg/jpeg.h | 190 +
swfdec/jpeg/jpeg_bits.c | 154 +
swfdec/jpeg/jpeg_bits.h | 32
swfdec/jpeg/jpeg_huffman.c | 168 +
swfdec/jpeg/jpeg_huffman.h | 37
swfdec/jpeg/jpeg_markers.h | 44
swfdec/jpeg/jpeg_rgb_decoder.c | 352 +++
swfdec/jpeg/jpeg_rgb_decoder.h | 18
swfdec/jpeg/jpeg_tables.c | 54
swfdec/swfdec.h | 48
swfdec/swfdec_accessibility.c | 50
swfdec/swfdec_amf.c | 225 +
swfdec/swfdec_amf.h | 59
swfdec/swfdec_as_array.c | 1399 ++++++++++++
swfdec/swfdec_as_array.h | 84
swfdec/swfdec_as_boolean.c | 103
swfdec/swfdec_as_boolean.h | 52
swfdec/swfdec_as_context.c | 1461 ++++++++++++
swfdec/swfdec_as_context.h | 143 +
swfdec/swfdec_as_date.c | 1162 ++++++++++
swfdec/swfdec_as_date.h | 60
swfdec/swfdec_as_debugger.c | 82
swfdec/swfdec_as_debugger.h | 80
swfdec/swfdec_as_frame.c | 895 +++++++
swfdec/swfdec_as_frame.h | 63
swfdec/swfdec_as_frame_internal.h | 106
swfdec/swfdec_as_function.c | 279 ++
swfdec/swfdec_as_function.h | 61
swfdec/swfdec_as_initialize.as | 100
swfdec/swfdec_as_initialize.h | 175 +
swfdec/swfdec_as_internal.h | 78
swfdec/swfdec_as_interpret.c | 3268 +++++++++++++++++++++++++++++
swfdec/swfdec_as_interpret.h | 150 +
swfdec/swfdec_as_math.c | 149 +
swfdec/swfdec_as_native_function.c | 395 +++
swfdec/swfdec_as_native_function.h | 95
swfdec/swfdec_as_number.c | 121 +
swfdec/swfdec_as_number.h | 52
swfdec/swfdec_as_object.c | 1773 +++++++++++++++
swfdec/swfdec_as_object.h | 190 +
swfdec/swfdec_as_script_function.c | 154 +
swfdec/swfdec_as_script_function.h | 61
swfdec/swfdec_as_stack.c | 200 +
swfdec/swfdec_as_stack.h | 101
swfdec/swfdec_as_string.c | 914 ++++++++
swfdec/swfdec_as_string.h | 62
swfdec/swfdec_as_strings.c | 491 ++++
swfdec/swfdec_as_super.c | 217 +
swfdec/swfdec_as_super.h | 59
swfdec/swfdec_as_types.c | 677 ++++++
swfdec/swfdec_as_types.h | 139 +
swfdec/swfdec_asbroadcaster.c | 84
swfdec/swfdec_audio.c | 346 +++
swfdec/swfdec_audio.h | 47
swfdec/swfdec_audio_event.c | 330 ++
swfdec/swfdec_audio_event.h | 74
swfdec/swfdec_audio_flv.c | 227 ++
swfdec/swfdec_audio_flv.h | 66
swfdec/swfdec_audio_internal.h | 77
swfdec/swfdec_audio_stream.c | 205 +
swfdec/swfdec_audio_stream.h | 65
swfdec/swfdec_bevel_filter.c | 226 ++
swfdec/swfdec_bitmap_data.c | 306 ++
swfdec/swfdec_bitmap_filter.c | 43
swfdec/swfdec_bits.c | 760 ++++++
swfdec/swfdec_bits.h | 75
swfdec/swfdec_blur_filter.c | 82
swfdec/swfdec_buffer.c | 641 +++++
swfdec/swfdec_buffer.h | 85
swfdec/swfdec_button.c | 302 ++
swfdec/swfdec_button.h | 83
swfdec/swfdec_button_movie.c | 320 ++
swfdec/swfdec_button_movie.h | 54
swfdec/swfdec_button_movie_as.c | 108
swfdec/swfdec_cache.c | 164 +
swfdec/swfdec_cache.h | 63
swfdec/swfdec_cached.c | 123 +
swfdec/swfdec_cached.h | 65
swfdec/swfdec_camera.c | 89
swfdec/swfdec_character.c | 42
swfdec/swfdec_character.h | 62
swfdec/swfdec_codec_adpcm.c | 186 +
swfdec/swfdec_codec_audio.c | 284 ++
swfdec/swfdec_codec_audio.h | 57
swfdec/swfdec_codec_ffmpeg.c | 317 ++
swfdec/swfdec_codec_gst.c | 615 +++++
swfdec/swfdec_codec_mad.c | 235 ++
swfdec/swfdec_codec_screen.c | 134 +
swfdec/swfdec_codec_video.c | 320 ++
swfdec/swfdec_codec_video.h | 75
swfdec/swfdec_codec_vp6_alpha.c | 111
swfdec/swfdec_color.c | 299 ++
swfdec/swfdec_color.h | 75
swfdec/swfdec_color_as.c | 181 +
swfdec/swfdec_color_matrix_filter.c | 53
swfdec/swfdec_color_transform.c | 206 +
swfdec/swfdec_convolution_filter.c | 197 +
swfdec/swfdec_debug.c | 78
swfdec/swfdec_debug.h | 65
swfdec/swfdec_debugger.c | 617 +++++
swfdec/swfdec_debugger.h | 108
swfdec/swfdec_decoder.c | 103
swfdec/swfdec_decoder.h | 93
swfdec/swfdec_displacement_map_filter.c | 197 +
swfdec/swfdec_draw.c | 190 +
swfdec/swfdec_draw.h | 85
swfdec/swfdec_drop_shadow_filter.c | 233 ++
swfdec/swfdec_event.c | 231 ++
swfdec/swfdec_event.h | 77
swfdec/swfdec_external_interface.c | 228 ++
swfdec/swfdec_file_loader.c | 98
swfdec/swfdec_file_loader.h | 52
swfdec/swfdec_file_reference.c | 139 +
swfdec/swfdec_file_reference_list.c | 33
swfdec/swfdec_filter.c | 124 +
swfdec/swfdec_filter.h | 60
swfdec/swfdec_filter_as.c | 47
swfdec/swfdec_flv_decoder.c | 595 +++++
swfdec/swfdec_flv_decoder.h | 83
swfdec/swfdec_font.c | 457 ++++
swfdec/swfdec_font.h | 89
swfdec/swfdec_function_list.c | 132 +
swfdec/swfdec_function_list.h | 50
swfdec/swfdec_glow_filter.c | 162 +
swfdec/swfdec_gradient_filter.c | 243 ++
swfdec/swfdec_gradient_pattern.c | 129 +
swfdec/swfdec_gradient_pattern.h | 67
swfdec/swfdec_graphic.c | 71
swfdec/swfdec_graphic.h | 78
swfdec/swfdec_graphic_movie.c | 113 +
swfdec/swfdec_graphic_movie.h | 51
swfdec/swfdec_image.c | 710 ++++++
swfdec/swfdec_image.h | 84
swfdec/swfdec_image_decoder.c | 131 +
swfdec/swfdec_image_decoder.h | 59
swfdec/swfdec_initialize.as | 1521 +++++++++++++
swfdec/swfdec_initialize.h | 2196 +++++++++++++++++++
swfdec/swfdec_internal.h | 68
swfdec/swfdec_interval.c | 193 +
swfdec/swfdec_interval.h | 80
swfdec/swfdec_key_as.c | 83
swfdec/swfdec_keys.h | 126 +
swfdec/swfdec_load_object.c | 259 ++
swfdec/swfdec_load_object.h | 76
swfdec/swfdec_load_object_as.c | 141 +
swfdec/swfdec_loader.c | 443 +++
swfdec/swfdec_loader.h | 97
swfdec/swfdec_loader_internal.h | 47
swfdec/swfdec_loadvars_as.c | 46
swfdec/swfdec_local_connection.c | 57
swfdec/swfdec_marshal.list | 6
swfdec/swfdec_microphone.c | 74
swfdec/swfdec_morph_movie.c | 133 +
swfdec/swfdec_morph_movie.h | 54
swfdec/swfdec_morphshape.c | 96
swfdec/swfdec_morphshape.h | 53
swfdec/swfdec_mouse_as.c | 51
swfdec/swfdec_movie.c | 1820 ++++++++++++++++
swfdec/swfdec_movie.h | 306 ++
swfdec/swfdec_movie_as_drawing.c | 456 ++++
swfdec/swfdec_movie_asprops.c | 484 ++++
swfdec/swfdec_movie_clip_loader.c | 127 +
swfdec/swfdec_movie_clip_loader.h | 51
swfdec/swfdec_net_connection.c | 186 +
swfdec/swfdec_net_connection.h | 57
swfdec/swfdec_net_stream.c | 662 +++++
swfdec/swfdec_net_stream.h | 99
swfdec/swfdec_net_stream_as.c | 187 +
swfdec/swfdec_path.c | 273 ++
swfdec/swfdec_path.h | 67
swfdec/swfdec_pattern.c | 559 ++++
swfdec/swfdec_pattern.h | 75
swfdec/swfdec_player.c | 3033 ++++++++++++++++++++++++++
swfdec/swfdec_player.h | 177 +
swfdec/swfdec_player_as.c | 367 +++
swfdec/swfdec_player_internal.h | 263 ++
swfdec/swfdec_player_scripting.c | 39
swfdec/swfdec_player_scripting.h | 62
swfdec/swfdec_policy_file.c | 350 +++
swfdec/swfdec_policy_file.h | 65
swfdec/swfdec_print_job.c | 130 +
swfdec/swfdec_rect.c | 223 +
swfdec/swfdec_rect.h | 51
swfdec/swfdec_rectangle.c | 203 +
swfdec/swfdec_rectangle.h | 55
swfdec/swfdec_resource.c | 691 ++++++
swfdec/swfdec_resource.h | 98
swfdec/swfdec_ringbuffer.c | 125 +
swfdec/swfdec_ringbuffer.h | 59
swfdec/swfdec_sandbox.c | 303 ++
swfdec/swfdec_sandbox.h | 83
swfdec/swfdec_script.c | 316 ++
swfdec/swfdec_script.h | 38
swfdec/swfdec_script_internal.h | 95
swfdec/swfdec_selection.c | 75
swfdec/swfdec_shape.c | 387 +++
swfdec/swfdec_shape.h | 63
swfdec/swfdec_shape_parser.c | 675 +++++
swfdec/swfdec_shape_parser.h | 48
swfdec/swfdec_shared_object.c | 82
swfdec/swfdec_socket.c | 98
swfdec/swfdec_socket.h | 61
swfdec/swfdec_sound.c | 558 ++++
swfdec/swfdec_sound.h | 107
swfdec/swfdec_sound_object.c | 340 +++
swfdec/swfdec_sound_object.h | 54
swfdec/swfdec_sprite.c | 217 +
swfdec/swfdec_sprite.h | 100
swfdec/swfdec_sprite_movie.c | 883 +++++++
swfdec/swfdec_sprite_movie.h | 76
swfdec/swfdec_sprite_movie_as.c | 891 +++++++
swfdec/swfdec_stage_as.c | 246 ++
swfdec/swfdec_stream.c | 427 +++
swfdec/swfdec_stream.h | 71
swfdec/swfdec_stream_target.c | 136 +
swfdec/swfdec_stream_target.h | 67
swfdec/swfdec_stroke.c | 361 +++
swfdec/swfdec_stroke.h | 76
swfdec/swfdec_style_sheet.c | 366 +++
swfdec/swfdec_style_sheet.h | 57
swfdec/swfdec_swf_decoder.c | 487 ++++
swfdec/swfdec_swf_decoder.h | 98
swfdec/swfdec_system.c | 315 ++
swfdec/swfdec_system.h | 76
swfdec/swfdec_system_as.c | 347 +++
swfdec/swfdec_system_ime.c | 79
swfdec/swfdec_system_security.c | 123 +
swfdec/swfdec_tag.c | 628 +++++
swfdec/swfdec_tag.h | 121 +
swfdec/swfdec_text.c | 133 +
swfdec/swfdec_text.h | 67
swfdec/swfdec_text_field.c | 198 +
swfdec/swfdec_text_field.h | 93
swfdec/swfdec_text_field_movie.c | 1627 ++++++++++++++
swfdec/swfdec_text_field_movie.h | 160 +
swfdec/swfdec_text_field_movie_as.c | 1539 +++++++++++++
swfdec/swfdec_text_field_movie_html.c | 777 ++++++
swfdec/swfdec_text_format.c | 1274 +++++++++++
swfdec/swfdec_text_format.h | 101
swfdec/swfdec_text_renderer.c | 94
swfdec/swfdec_text_snapshot.c | 109
swfdec/swfdec_transform.c | 121 +
swfdec/swfdec_types.h | 63
swfdec/swfdec_url.c | 709 ++++++
swfdec/swfdec_url.h | 69
swfdec/swfdec_utils.c | 74
swfdec/swfdec_utils.h | 40
swfdec/swfdec_video.c | 302 ++
swfdec/swfdec_video.h | 61
swfdec/swfdec_video_movie.c | 197 +
swfdec/swfdec_video_movie.h | 77
swfdec/swfdec_video_movie_as.c | 94
swfdec/swfdec_xml.c | 940 ++++++++
swfdec/swfdec_xml.h | 90
swfdec/swfdec_xml_node.c | 1113 +++++++++
swfdec/swfdec_xml_node.h | 103
swfdec/swfdec_xml_socket.c | 245 ++
swfdec/swfdec_xml_socket.h | 56
test/rtmp/rtmp_server.c | 2
test/sound/sound.c | 21
test/swfdec_test.c | 6
test/swfdec_test_function.h | 2
test/swfdec_test_global.c | 2
test/swfdec_test_image.h | 2
test/swfdec_test_test.c | 7
test/swfdec_test_test.h | 2
test/various/gc.c | 12
test/various/ringbuffer.c | 2
tools/crashfinder.c | 20
tools/dump.c | 34
tools/swfdec-extract.c | 28
tools/swfdec_out.h | 6
tools/swfedit_file.c | 8
tools/swfedit_file.h | 2
tools/swfedit_tag.c | 8
tools/swfedit_tag.h | 4
tools/swfedit_token.c | 6
tools/swfedit_token.h | 2
tools/swfscript.c | 2
vivified/core/vivi_application.c | 10
vivified/core/vivi_application.h | 2
vivified/core/vivi_breakpoint.h | 2
vivified/core/vivi_debugger.c | 2
vivified/core/vivi_debugger.h | 2
vivified/core/vivi_function.h | 2
vivified/core/vivi_ming.h | 2
vivified/core/vivi_player_as.c | 2
vivified/core/vivi_wrap.h | 2
vivified/ui/main.c | 2
vivified/ui/vivi_movie_list.c | 4
vivified/ui/vivi_movies.c | 2
vivified/ui/vivi_player.c | 2
vivified/ui/vivi_widget.h | 2
vivified/ui/vivi_window.h | 2
618 files changed, 74195 insertions(+), 73949 deletions(-)
New commits:
commit 222cb3e42603590d7ca94d6d81aad941cc511c38
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Jan 25 16:53:05 2008 +0100
set varaible before using it
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index e9e50bc..419a6b8 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -3025,6 +3025,7 @@ swfdec_player_set_variables (SwfdecPlayer *player, const char *variables)
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (player->priv->url == NULL);
+ priv = player->priv;
g_free (priv->variables);
priv->variables = g_strdup (variables);
g_object_notify (G_OBJECT (player), "variables");
commit e142c2e56c24ab42a91f9519fd9a8dbfd8cf043e
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Jan 25 14:00:36 2008 +0100
skip events for uninitialized movies
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 278a067..10662c5 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -526,6 +526,11 @@ swfdec_movie_queue_script (SwfdecMovie *movie, SwfdecEventType condition)
if (!SWFDEC_IS_SPRITE_MOVIE (movie) && !SWFDEC_IS_BUTTON_MOVIE (movie))
return;
+ /* can happen for mouse/keyboard events on the initial movie */
+ if (movie->resource->sandbox == NULL) {
+ SWFDEC_INFO ("movie %s not yet initialized, skipping event", movie->name);
+ return;
+ }
switch (condition) {
case SWFDEC_EVENT_INITIALIZE:
commit c3f1a527ce2f222d140bc77554ecec42232010ad
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Jan 25 13:57:25 2008 +0100
use the right private object
Oops, stupid copy/paste errors
diff --git a/swfdec-gtk/swfdec_gtk_player.c b/swfdec-gtk/swfdec_gtk_player.c
index f8f9d5c..42fc01b 100644
--- a/swfdec-gtk/swfdec_gtk_player.c
+++ b/swfdec-gtk/swfdec_gtk_player.c
@@ -149,7 +149,7 @@ swfdec_gtk_player_init (SwfdecGtkPlayer * player)
{
SwfdecGtkPlayerPrivate *priv;
- player->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (player, SWFDEC_TYPE_PLAYER, SwfdecGtkPlayerPrivate);
+ player->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (player, SWFDEC_TYPE_GTK_PLAYER, SwfdecGtkPlayerPrivate);
priv->speed = 1.0;
priv->audio_enabled = TRUE;
commit 5d70b97559f75125f9a310b41360ff350140b5f8
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Jan 25 10:57:46 2008 +0100
initialize url and base-url properties before requesting the first loader
This allows the loader to access these values
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index 2795d82..e9e50bc 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -2971,13 +2971,15 @@ swfdec_player_set_url (SwfdecPlayer *player, const SwfdecURL *url)
g_object_freeze_notify (G_OBJECT (player));
priv = player->priv;
priv->url = swfdec_url_copy (url);
- loader = swfdec_player_load (player, swfdec_url_get_url (url),
- SWFDEC_LOADER_REQUEST_DEFAULT, NULL);
- priv->resource = swfdec_resource_new (player, loader, priv->variables);
if (priv->base_url == NULL) {
- priv->base_url = swfdec_url_new_parent (swfdec_loader_get_url (loader));
+ priv->base_url = swfdec_url_new_parent (url);
g_object_notify (G_OBJECT (player), "base-url");
}
+ /* we initialize url and base_url before requesting the loader, so the loader
+ * can query them */
+ loader = swfdec_player_load (player, swfdec_url_get_url (url),
+ SWFDEC_LOADER_REQUEST_DEFAULT, NULL);
+ priv->resource = swfdec_resource_new (player, loader, priv->variables);
movie = swfdec_movie_new (player, -16384, NULL, priv->resource, NULL, SWFDEC_AS_STR__level0);
movie->name = SWFDEC_AS_STR_EMPTY;
g_object_unref (loader);
commit 66074294ab0f9d0f4908223ecfaa41f2a3bd6c3d
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Jan 24 20:54:58 2008 +0100
make SwfdecGtkPlayer subclassable
diff --git a/swfdec-gtk/swfdec_gtk_player.c b/swfdec-gtk/swfdec_gtk_player.c
index 71ff829..f8f9d5c 100644
--- a/swfdec-gtk/swfdec_gtk_player.c
+++ b/swfdec-gtk/swfdec_gtk_player.c
@@ -27,21 +27,14 @@
#include "swfdec-gtk/swfdec_playback.h"
#include "swfdec-gtk/swfdec_source.h"
-struct _SwfdecGtkPlayer
+struct _SwfdecGtkPlayerPrivate
{
- SwfdecPlayer player;
-
GSource * source; /* source if playing, NULL otherwise */
SwfdecPlayback * playback; /* audio playback object */
gboolean audio_enabled; /* TRUE if audio should be played */
double speed; /* desired playback speed */
};
-struct _SwfdecGtkPlayerClass
-{
- SwfdecPlayerClass player_class;
-};
-
enum {
PROP_0,
PROP_PLAYING,
@@ -78,17 +71,17 @@ static void
swfdec_gtk_player_get_property (GObject *object, guint param_id, GValue *value,
GParamSpec * pspec)
{
- SwfdecGtkPlayer *player = SWFDEC_GTK_PLAYER (object);
+ SwfdecGtkPlayerPrivate *priv = SWFDEC_GTK_PLAYER (object)->priv;
switch (param_id) {
case PROP_PLAYING:
- g_value_set_boolean (value, player->source != NULL);
+ g_value_set_boolean (value, priv->source != NULL);
break;
case PROP_AUDIO:
- g_value_set_boolean (value, player->audio_enabled);
+ g_value_set_boolean (value, priv->audio_enabled);
break;
case PROP_SPEED:
- g_value_set_double (value, player->speed);
+ g_value_set_double (value, priv->speed);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -124,7 +117,7 @@ swfdec_gtk_player_dispose (GObject *object)
SwfdecGtkPlayer *player = SWFDEC_GTK_PLAYER (object);
swfdec_gtk_player_set_playing (player, FALSE);
- g_assert (player->playback == NULL);
+ g_assert (player->priv->playback == NULL);
G_OBJECT_CLASS (swfdec_gtk_player_parent_class)->dispose (object);
}
@@ -134,6 +127,8 @@ swfdec_gtk_player_class_init (SwfdecGtkPlayerClass * g_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (g_class);
+ g_type_class_add_private (g_class, sizeof (SwfdecGtkPlayerPrivate));
+
object_class->dispose = swfdec_gtk_player_dispose;
object_class->get_property = swfdec_gtk_player_get_property;
object_class->set_property = swfdec_gtk_player_set_property;
@@ -152,8 +147,12 @@ swfdec_gtk_player_class_init (SwfdecGtkPlayerClass * g_class)
static void
swfdec_gtk_player_init (SwfdecGtkPlayer * player)
{
- player->speed = 1.0;
- player->audio_enabled = TRUE;
+ SwfdecGtkPlayerPrivate *priv;
+
+ player->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (player, SWFDEC_TYPE_PLAYER, SwfdecGtkPlayerPrivate);
+
+ priv->speed = 1.0;
+ priv->audio_enabled = TRUE;
}
/*** PUBLIC API ***/
@@ -183,17 +182,18 @@ swfdec_gtk_player_new (SwfdecAsDebugger *debugger)
static void
swfdec_gtk_player_update_audio (SwfdecGtkPlayer *player)
{
- gboolean should_play = player->audio_enabled;
+ SwfdecGtkPlayerPrivate *priv = player->priv;
+ gboolean should_play = priv->audio_enabled;
- should_play &= (player->source != NULL);
- should_play &= (player->speed == 1.0);
+ should_play &= (priv->source != NULL);
+ should_play &= (priv->speed == 1.0);
- if (should_play && player->playback == NULL) {
- player->playback = swfdec_playback_open (SWFDEC_PLAYER (player),
+ if (should_play && priv->playback == NULL) {
+ priv->playback = swfdec_playback_open (SWFDEC_PLAYER (player),
g_main_context_default ());
- } else if (!should_play && player->playback != NULL) {
- swfdec_playback_close (player->playback);
- player->playback = NULL;
+ } else if (!should_play && priv->playback != NULL) {
+ swfdec_playback_close (priv->playback);
+ priv->playback = NULL;
}
}
@@ -209,15 +209,18 @@ swfdec_gtk_player_update_audio (SwfdecGtkPlayer *player)
void
swfdec_gtk_player_set_playing (SwfdecGtkPlayer *player, gboolean playing)
{
+ SwfdecGtkPlayerPrivate *priv;
+
g_return_if_fail (SWFDEC_IS_GTK_PLAYER (player));
- if (playing && player->source == NULL) {
- player->source = swfdec_iterate_source_new (SWFDEC_PLAYER (player), player->speed);
- g_source_attach (player->source, NULL);
- } else if (!playing && player->source != NULL) {
- g_source_destroy (player->source);
- g_source_unref (player->source);
- player->source = NULL;
+ priv = player->priv;
+ if (playing && priv->source == NULL) {
+ priv->source = swfdec_iterate_source_new (SWFDEC_PLAYER (player), priv->speed);
+ g_source_attach (priv->source, NULL);
+ } else if (!playing && priv->source != NULL) {
+ g_source_destroy (priv->source);
+ g_source_unref (priv->source);
+ priv->source = NULL;
}
swfdec_gtk_player_update_audio (player);
g_object_notify (G_OBJECT (player), "playing");
@@ -236,7 +239,7 @@ swfdec_gtk_player_get_playing (SwfdecGtkPlayer *player)
{
g_return_val_if_fail (SWFDEC_IS_GTK_PLAYER (player), FALSE);
- return player->source != NULL;
+ return player->priv->source != NULL;
}
/**
@@ -251,9 +254,9 @@ swfdec_gtk_player_set_audio_enabled (SwfdecGtkPlayer *player, gboolean enabled)
{
g_return_if_fail (SWFDEC_IS_GTK_PLAYER (player));
- if (player->audio_enabled == enabled)
+ if (player->priv->audio_enabled == enabled)
return;
- player->audio_enabled = enabled;
+ player->priv->audio_enabled = enabled;
swfdec_gtk_player_update_audio (player);
g_object_notify (G_OBJECT (player), "audio-enabled");
}
@@ -271,7 +274,7 @@ swfdec_gtk_player_get_audio_enabled (SwfdecGtkPlayer *player)
{
g_return_val_if_fail (SWFDEC_IS_GTK_PLAYER (player), FALSE);
- return player->audio_enabled;
+ return player->priv->audio_enabled;
}
/**
@@ -290,10 +293,10 @@ swfdec_gtk_player_set_speed (SwfdecGtkPlayer *player, double speed)
g_return_if_fail (SWFDEC_IS_GTK_PLAYER (player));
g_return_if_fail (speed > 0.0);
- player->speed = speed;
+ player->priv->speed = speed;
swfdec_gtk_player_update_audio (player);
- if (player->source)
- swfdec_iterate_source_set_speed (player->source, player->speed);
+ if (player->priv->source)
+ swfdec_iterate_source_set_speed (player->priv->source, player->priv->speed);
g_object_notify (G_OBJECT (player), "speed");
}
@@ -311,5 +314,5 @@ swfdec_gtk_player_get_speed (SwfdecGtkPlayer *player)
{
g_return_val_if_fail (SWFDEC_IS_GTK_PLAYER (player), FALSE);
- return player->speed;
+ return player->priv->speed;
}
diff --git a/swfdec-gtk/swfdec_gtk_player.h b/swfdec-gtk/swfdec_gtk_player.h
index dd4b51d..4abef90 100644
--- a/swfdec-gtk/swfdec_gtk_player.h
+++ b/swfdec-gtk/swfdec_gtk_player.h
@@ -25,6 +25,7 @@
G_BEGIN_DECLS
typedef struct _SwfdecGtkPlayer SwfdecGtkPlayer;
+typedef struct _SwfdecGtkPlayerPrivate SwfdecGtkPlayerPrivate;
typedef struct _SwfdecGtkPlayerClass SwfdecGtkPlayerClass;
#define SWFDEC_TYPE_GTK_PLAYER (swfdec_gtk_player_get_type())
@@ -34,6 +35,18 @@ typedef struct _SwfdecGtkPlayerClass SwfdecGtkPlayerClass;
#define SWFDEC_GTK_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_GTK_PLAYER, SwfdecGtkPlayerClass))
#define SWFDEC_GTK_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_GTK_PLAYER, SwfdecGtkPlayerClass))
+struct _SwfdecGtkPlayer
+{
+ SwfdecPlayer player;
+
+ SwfdecGtkPlayerPrivate * priv;
+};
+
+struct _SwfdecGtkPlayerClass
+{
+ SwfdecPlayerClass player_class;
+};
+
GType swfdec_gtk_player_get_type (void);
SwfdecPlayer * swfdec_gtk_player_new (SwfdecAsDebugger * debugger);
commit f30a1b7475cdf50938d830926e65cc9e9588874a
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Jan 24 16:42:52 2008 +0100
port to libsoup 2.4
diff --git a/configure.ac b/configure.ac
index 2d34a55..02281c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,7 +107,7 @@ dnl
GTK_VER=2.8.0
AC_SUBST(GTK_VER)
if test "$enable_gtk" = "yes"; then
- PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_VER libsoup-2.2 >= 2.2.0, HAVE_GTK=yes)
+ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_VER libsoup-2.4, HAVE_GTK=yes)
AC_DEFINE(HAVE_GTK, 1, [Define if Gtk is enabled])
else
AC_MSG_NOTICE([Gtk support was not enabled.])
diff --git a/swfdec-gtk/swfdec_gtk_loader.c b/swfdec-gtk/swfdec_gtk_loader.c
index 375ca60..ec6d78f 100644
--- a/swfdec-gtk/swfdec_gtk_loader.c
+++ b/swfdec-gtk/swfdec_gtk_loader.c
@@ -68,22 +68,6 @@ struct _SwfdecGtkLoaderClass {
G_DEFINE_TYPE (SwfdecGtkLoader, swfdec_gtk_loader, SWFDEC_TYPE_FILE_LOADER)
static void
-swfdec_gtk_loader_set_size (SwfdecGtkLoader *gtk)
-{
- const char *s = soup_message_get_header (gtk->message->response_headers, "Content-Length");
- unsigned long l;
- char *end;
-
- if (s == NULL)
- return;
-
- errno = 0;
- l = strtoul (s, &end, 10);
- if (errno == 0 && *end == 0 && l <= G_MAXLONG)
- swfdec_loader_set_size (SWFDEC_LOADER (gtk), l);
-}
-
-static void
swfdec_gtk_loader_ensure_open (SwfdecGtkLoader *gtk)
{
char *real_uri;
@@ -92,25 +76,39 @@ swfdec_gtk_loader_ensure_open (SwfdecGtkLoader *gtk)
return;
real_uri = soup_uri_to_string (soup_message_get_uri (gtk->message), FALSE);
- swfdec_gtk_loader_set_size (gtk);
swfdec_loader_set_url (SWFDEC_LOADER (gtk), real_uri);
+ g_free (real_uri);
+ if (soup_message_headers_get_encoding (gtk->message->response_headers) == SOUP_ENCODING_CONTENT_LENGTH) {
+ swfdec_loader_set_size (SWFDEC_LOADER (gtk),
+ soup_message_headers_get_content_length (gtk->message->response_headers));
+ }
swfdec_stream_open (SWFDEC_STREAM (gtk));
gtk->opened = TRUE;
- g_free (real_uri);
}
static void
-swfdec_gtk_loader_push (SoupMessage *msg, gpointer loader)
+swfdec_gtk_loader_free_soup_buffer (unsigned char *data, gpointer chunk)
+{
+ soup_buffer_free (chunk);
+}
+
+static void
+swfdec_gtk_loader_push (SoupMessage *msg, SoupBuffer *chunk, gpointer loader)
{
SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (loader);
SwfdecBuffer *buffer;
+ chunk = soup_buffer_copy (chunk);
+
swfdec_gtk_loader_ensure_open (gtk);
- buffer = swfdec_buffer_new_and_alloc (msg->response.length);
- memcpy (buffer->data, msg->response.body, msg->response.length);
+ buffer = swfdec_buffer_new ();
+ buffer->data = (unsigned char *) chunk->data;
+ buffer->length = chunk->length;
+ buffer->priv = chunk;
+ buffer->free = swfdec_gtk_loader_free_soup_buffer;
swfdec_stream_push (loader, buffer);
}
-
+
static void
swfdec_gtk_loader_finished (SoupMessage *msg, gpointer loader)
{
@@ -167,8 +165,8 @@ swfdec_gtk_loader_load (SwfdecLoader *loader, SwfdecPlayer *player,
g_signal_connect (gtk->message, "got-chunk", G_CALLBACK (swfdec_gtk_loader_push), gtk);
g_signal_connect (gtk->message, "finished", G_CALLBACK (swfdec_gtk_loader_finished), gtk);
if (buffer)
- soup_message_set_request (gtk->message, "appliation/x-www-urlencoded",
- SOUP_BUFFER_USER_OWNED, (char *) buffer->data, buffer->length);
+ soup_message_set_request (gtk->message, "appliation/x-www-form-urlencoded",
+ SOUP_MEMORY_COPY, (char *) buffer->data, buffer->length);
g_object_ref (gtk->message);
soup_session_queue_message (klass->session, gtk->message, NULL, NULL);
}
@@ -187,7 +185,7 @@ swfdec_gtk_loader_close (SwfdecStream *stream)
if (!eof) {
SwfdecGtkLoaderClass *klass = SWFDEC_GTK_LOADER_GET_CLASS (gtk);
- soup_session_cancel_message (klass->session, gtk->message);
+ soup_session_cancel_message (klass->session, gtk->message, SOUP_STATUS_CANCELLED);
g_object_unref (gtk->message);
gtk->message = NULL;
}
diff --git a/swfdec-gtk/swfdec_gtk_socket.c b/swfdec-gtk/swfdec_gtk_socket.c
index 03bedd9..8385cf1 100644
--- a/swfdec-gtk/swfdec_gtk_socket.c
+++ b/swfdec-gtk/swfdec_gtk_socket.c
@@ -70,12 +70,12 @@ swfdec_gtk_socket_close (SwfdecStream *stream)
}
static void
-swfdec_gtk_socket_do_connect (SoupSocket *sock, int status, SwfdecGtkSocket *gtk)
+swfdec_gtk_socket_do_connect (SoupSocket *sock, guint status, gpointer gtk)
{
if (SOUP_STATUS_IS_SUCCESSFUL (status))
- swfdec_stream_open (SWFDEC_STREAM (gtk));
+ swfdec_stream_open (gtk);
else
- swfdec_stream_error (SWFDEC_STREAM (gtk), "error connecting");
+ swfdec_stream_error (gtk, "error connecting");
}
@@ -92,10 +92,12 @@ swfdec_gtk_socket_do_read (SoupSocket *sock, SwfdecGtkSocket *gtk)
SwfdecBuffer *buffer;
SoupSocketIOStatus status;
gsize len;
+ GError *error = NULL;
do {
buffer = swfdec_buffer_new_and_alloc (SWFDEC_GTK_SOCKET_BLOCK_SIZE);
- status = soup_socket_read (sock, buffer, SWFDEC_GTK_SOCKET_BLOCK_SIZE, &len);
+ status = soup_socket_read (sock, buffer, SWFDEC_GTK_SOCKET_BLOCK_SIZE,
+ &len, NULL, &error);
buffer->length = len;
switch (status) {
case SOUP_SOCKET_OK:
@@ -107,7 +109,8 @@ swfdec_gtk_socket_do_read (SoupSocket *sock, SwfdecGtkSocket *gtk)
break;
case SOUP_SOCKET_ERROR:
swfdec_buffer_unref (buffer);
- swfdec_stream_error (SWFDEC_STREAM (gtk), "error reading data");
+ swfdec_stream_error (SWFDEC_STREAM (gtk), "%s", error->message);
+ g_error_free (error);
break;
default:
g_warning ("unhandled status code %u from soup_socket_read()", (guint) status);
@@ -121,11 +124,13 @@ swfdec_gtk_socket_do_write (SoupSocket *sock, SwfdecGtkSocket *gtk)
{
SwfdecBuffer *buffer;
SoupSocketIOStatus status;
+ GError *error = NULL;
gsize len;
gtk->sock_writable = TRUE;
while ((buffer = swfdec_buffer_queue_peek_buffer (gtk->queue))) {
- status = soup_socket_write (sock, buffer->data, buffer->length, &len);
+ status = soup_socket_write (sock, buffer->data, buffer->length,
+ &len, NULL, &error);
swfdec_buffer_unref (buffer);
switch (status) {
case SOUP_SOCKET_OK:
@@ -137,8 +142,9 @@ swfdec_gtk_socket_do_write (SoupSocket *sock, SwfdecGtkSocket *gtk)
gtk->sock_writable = FALSE;
break;
case SOUP_SOCKET_ERROR:
- swfdec_stream_error (SWFDEC_STREAM (gtk), "error writing data");
- break;
+ swfdec_stream_error (SWFDEC_STREAM (gtk), "%s", error->message);
+ g_error_free (error);
+ return;
default:
g_warning ("unhandled status code %u from soup_socket_read()", (guint) status);
break;
@@ -156,17 +162,14 @@ swfdec_gtk_socket_connect (SwfdecSocket *sock_, SwfdecPlayer *player,
addr = soup_address_new (hostname, port);
sock->sock = soup_socket_new (
SOUP_SOCKET_FLAG_NONBLOCKING, TRUE,
- /* FIXME: we should set nodelay, no? */
- SOUP_SOCKET_FLAG_NODELAY, TRUE, NULL);
- g_signal_connect (sock->sock, "connect-result",
- G_CALLBACK (swfdec_gtk_socket_do_connect), socket);
+ SOUP_SOCKET_REMOTE_ADDRESS, addr, NULL);
g_signal_connect (sock->sock, "disconnect",
G_CALLBACK (swfdec_gtk_socket_do_disconnect), socket);
g_signal_connect (sock->sock, "readable",
G_CALLBACK (swfdec_gtk_socket_do_read), socket);
g_signal_connect (sock->sock, "writable",
G_CALLBACK (swfdec_gtk_socket_do_write), socket);
- soup_socket_connect (sock->sock, addr);
+ soup_socket_connect_async (sock->sock, NULL, swfdec_gtk_socket_do_connect, sock);
}
static void
commit a61fbe67383e2395da7c3f83c82c5126af326d57
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Jan 24 16:02:31 2008 +0100
make SwfdecSocket creation work like SwfdecLoader creation
This allows for better subclassing
diff --git a/swfdec-gtk/swfdec_gtk_socket.c b/swfdec-gtk/swfdec_gtk_socket.c
index 08cbb76..03bedd9 100644
--- a/swfdec-gtk/swfdec_gtk_socket.c
+++ b/swfdec-gtk/swfdec_gtk_socket.c
@@ -146,14 +146,16 @@ swfdec_gtk_socket_do_write (SoupSocket *sock, SwfdecGtkSocket *gtk)
};
}
-static SwfdecSocket *
-swfdec_gtk_socket_create (const char *hostname, guint port)
+static void
+swfdec_gtk_socket_connect (SwfdecSocket *sock_, SwfdecPlayer *player,
+ const char *hostname, guint port)
{
- SwfdecGtkSocket *sock = g_object_new (SWFDEC_TYPE_GTK_SOCKET, NULL);
+ SwfdecGtkSocket *sock = SWFDEC_GTK_SOCKET (sock_);
SoupAddress *addr;
addr = soup_address_new (hostname, port);
- sock->sock = soup_socket_new (SOUP_SOCKET_FLAG_NONBLOCKING, TRUE,
+ sock->sock = soup_socket_new (
+ SOUP_SOCKET_FLAG_NONBLOCKING, TRUE,
/* FIXME: we should set nodelay, no? */
SOUP_SOCKET_FLAG_NODELAY, TRUE, NULL);
g_signal_connect (sock->sock, "connect-result",
@@ -164,8 +166,7 @@ swfdec_gtk_socket_create (const char *hostname, guint port)
G_CALLBACK (swfdec_gtk_socket_do_read), socket);
g_signal_connect (sock->sock, "writable",
G_CALLBACK (swfdec_gtk_socket_do_write), socket);
-
- return SWFDEC_SOCKET (sock);
+ soup_socket_connect (sock->sock, addr);
}
static void
@@ -207,7 +208,7 @@ swfdec_gtk_socket_class_init (SwfdecGtkSocketClass *klass)
stream_class->close = swfdec_gtk_socket_close;
- socket_class->create = swfdec_gtk_socket_create;
+ socket_class->connect = swfdec_gtk_socket_connect;
socket_class->send = swfdec_gtk_socket_send;
}
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index 5b996ef..2795d82 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -2151,9 +2151,9 @@ swfdec_player_create_socket (SwfdecPlayer *player, const char *hostname, guint p
SWFDEC_INFO ("can't create socket, no socket type set.");
return NULL;
}
- klass = g_type_class_ref (player->priv->socket_type);
- sock = klass->create (hostname, port);
- g_type_class_unref (klass);
+ sock = g_object_new (player->priv->socket_type, NULL);
+ klass = SWFDEC_SOCKET_GET_CLASS (sock);
+ klass->connect (sock, player, hostname, port);
return sock;
}
diff --git a/swfdec/swfdec_socket.c b/swfdec/swfdec_socket.c
index c02c790..19f47aa 100644
--- a/swfdec/swfdec_socket.c
+++ b/swfdec/swfdec_socket.c
@@ -51,10 +51,9 @@
/**
* SwfdecSocketClass:
- * @create: Create a new socket for the given hostname and port. This function
- * must return a new socket, returning %NULL is not allowed. If you
- * encounter an error, create a new socket and call
- * swfdec_stream_error() on it.
+ * @connect: Connect the given newly created socket to the given hostname and
+ * port. If you encounter an error, call swfdec_stream_error(), but
+ * still make sure the socket object does not break.
* @send: Called to send data down the given socket. This function will only be
* called when the socket is open. You get passed a reference to the
* buffer, so it is your responsibility to call swfdec_buffer_unref() on
diff --git a/swfdec/swfdec_socket.h b/swfdec/swfdec_socket.h
index ca750af..6b43f22 100644
--- a/swfdec/swfdec_socket.h
+++ b/swfdec/swfdec_socket.h
@@ -22,6 +22,7 @@
#include <glib-object.h>
#include <swfdec/swfdec_stream.h>
+#include <swfdec/swfdec_player.h>
G_BEGIN_DECLS
@@ -44,7 +45,9 @@ struct _SwfdecSocketClass
{
SwfdecStreamClass stream_class;
- SwfdecSocket * (* create) (const char * hostname,
+ void (* connect) (SwfdecSocket * socket,
+ SwfdecPlayer * player,
+ const char * hostname,
guint port);
void (* send) (SwfdecSocket * socket,
commit 4fe9f9476eb098ae6381e196647d0d00bdda9715
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Jan 24 15:38:06 2008 +0100
s/libswfdec/swfdec part 2
I didn't want to do it in 1 part, otherwise the renames wouldn't have been
renames
diff --git a/Makefile.am b/Makefile.am
index d13fae6..012b3e7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
if WITH_GTK
GTK_SUBDIRS = \
- libswfdec-gtk \
+ swfdec-gtk \
doc \
player
else
@@ -14,7 +14,7 @@ VIVI_SUBDIRS =
endif
SUBDIRS= \
- libswfdec \
+ swfdec \
$(GTK_SUBDIRS) \
$(VIVI_SUBDIRS) \
data \
diff --git a/README b/README
index 60130b9..3c51157 100644
--- a/README
+++ b/README
@@ -3,7 +3,7 @@ Swfdec is a decoder/renderer for Macromedia Flash animations. The decoding and
rendering engine is provided in a library that can be used by other
applications.
-An additional library named libswfdec-gtk is provided for easy integration of
+An additional library named swfdec-gtk is provided for easy integration of
Swfdec into Gtk applications. This library is what developers most likely want
to target their applications at. Building this library can be disabled.
@@ -14,8 +14,8 @@ it crashes. If you encounter such a crash however, make sure to file a bug
immediately.
Swfdec contains some applications for testing and debugging the library. These
-are available in the player/ and test/ directory. They are not installed. Most
-of them require the libswfdec-gtk library.
+are available in the player/, test/ and tools/ directories. They are not
+installed. Most of them require the swfdec-gtk library.
The test/ directory contains subdirectories that run automated tests with the
provided SWF files in the directory. See the README files in those directories
@@ -69,7 +69,7 @@ Dependencies:
GStreamer (>= 0.10.11 - optional, required for various audio and video formats)
MAD (>= 0.15.1b - optional, required for MP3 audio format support)
- GTK+ (>= 2.8.0 - used by libswfdec-gtk)
- ALSA (>= 1.0 - used by libswfdec-gtk)
+ GTK+ (>= 2.8.0 - used by swfdec-gtk)
+ ALSA (>= 1.0 - optional, required for sound output by swfdec-gtk)
diff --git a/configure.ac b/configure.ac
index 2690e2f..2d34a55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,7 +97,7 @@ AC_SUBST(PANGO_CFLAGS)
AC_ARG_ENABLE(gtk,
AS_HELP_STRING([--enable-gtk],
- [enable build of libswfdec-gtk (default=yes)])],
+ [enable build of swfdec-gtk (default=yes)])],
enable_gtk=$enableval,
enable_gtk="yes")
@@ -287,12 +287,12 @@ AC_SUBST(GLOBAL_CFLAGS)
AC_SUBST(GLOBAL_CFLAGS)
SWFDEC_CFLAGS="-I\$(top_srcdir) $GLIB_CFLAGS $CAIRO_CFLAGS"
-SWFDEC_LIBS="\$(top_builddir)/libswfdec/libswfdec-$SWFDEC_MAJORMINOR.la $GLIB_LIBS $CAIRO_LIBS -lz"
+SWFDEC_LIBS="\$(top_builddir)/swfdec/libswfdec-$SWFDEC_MAJORMINOR.la $GLIB_LIBS $CAIRO_LIBS -lz"
AC_SUBST(SWFDEC_LIBS)
AC_SUBST(SWFDEC_CFLAGS)
SWFDEC_GTK_CFLAGS="$SWFDEC_CFLAGS $GTK_CFLAGS"
-SWFDEC_GTK_LIBS="\$(top_builddir)/libswfdec-gtk/libswfdec-gtk-$SWFDEC_MAJORMINOR.la $SWFDEC_LIBS $GTK_LIBS"
+SWFDEC_GTK_LIBS="\$(top_builddir)/swfdec-gtk/libswfdec-gtk-$SWFDEC_MAJORMINOR.la $SWFDEC_LIBS $GTK_LIBS"
AC_SUBST(SWFDEC_GTK_LIBS)
AC_SUBST(SWFDEC_GTK_CFLAGS)
@@ -325,9 +325,9 @@ data/icons/scalable/Makefile
data/swfdec.pc
data/swfdec-gtk.pc
doc/Makefile
-libswfdec/Makefile
-libswfdec/jpeg/Makefile
-libswfdec-gtk/Makefile
+swfdec/Makefile
+swfdec/jpeg/Makefile
+swfdec-gtk/Makefile
player/Makefile
test/Makefile
test/custom/Makefile
diff --git a/doc/Makefile.am b/doc/Makefile.am
index d7e384b..37f9fb4 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -18,7 +18,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
# gtk-doc will search all .c & .h files beneath here for inline comments
# documenting the functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk
-DOC_SOURCE_DIR=../libswfdec
+DOC_SOURCE_DIR=../swfdec
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=--type-init-func="swfdec_init();"
@@ -29,7 +29,7 @@ SCAN_OPTIONS=
# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
-MKDB_OPTIONS=--sgml-mode --output-format=xml --source-dir=../libswfdec-gtk
+MKDB_OPTIONS=--sgml-mode --output-format=xml --source-dir=../swfdec-gtk
# Extra options to supply to gtkdoc-mktmpl
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
@@ -42,8 +42,8 @@ FIXXREF_OPTIONS=
# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
-HFILE_GLOB=$(top_srcdir)/libswfdec/*.h $(top_srcdir)/libswfdec-gtk/*.h
-CFILE_GLOB=$(top_srcdir)/libswfdec/*.c $(top_srcdir)/libswfdec-gtk/*.c
+HFILE_GLOB=$(top_srcdir)/swfdec/*.h $(top_srcdir)/swfdec-gtk/*.h
+CFILE_GLOB=$(top_srcdir)/swfdec/*.c $(top_srcdir)/swfdec-gtk/*.c
# Header files to ignore when scanning.
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
@@ -146,10 +146,10 @@ IGNORE_HFILES= \
if WITH_GTK
EXTRA_HFILES = \
- ../libswfdec-gtk/swfdec_gtk_keys.h \
- ../libswfdec-gtk/swfdec_gtk_loader.h \
- ../libswfdec-gtk/swfdec_gtk_player.h \
- ../libswfdec-gtk/swfdec_gtk_widget.h
+ ../swfdec-gtk/swfdec_gtk_keys.h \
+ ../swfdec-gtk/swfdec_gtk_loader.h \
+ ../swfdec-gtk/swfdec_gtk_player.h \
+ ../swfdec-gtk/swfdec_gtk_widget.h
else
EXTRA_HFILES =
endif
diff --git a/doc/swfdec.types b/doc/swfdec.types
index c89c6d5..4ef3276 100644
--- a/doc/swfdec.types
+++ b/doc/swfdec.types
@@ -1,5 +1,5 @@
-#include <libswfdec/swfdec.h>
-#include <libswfdec-gtk/swfdec-gtk.h>
+#include <swfdec/swfdec.h>
+#include <swfdec-gtk/swfdec-gtk.h>
swfdec_as_context_get_type
swfdec_as_object_get_type
diff --git a/player/swfdec_debug_script.h b/player/swfdec_debug_script.h
index 7c8bb5e..318a3be 100644
--- a/player/swfdec_debug_script.h
+++ b/player/swfdec_debug_script.h
@@ -21,7 +21,7 @@
#define _SWFDEC_DEBUG_SCRIPT_H_
#include <gtk/gtk.h>
-#include <libswfdec/swfdec_debugger.h>
+#include <swfdec/swfdec_debugger.h>
G_BEGIN_DECLS
diff --git a/player/swfdec_debug_scripts.c b/player/swfdec_debug_scripts.c
index 14471c3..b845f84 100644
--- a/player/swfdec_debug_scripts.c
+++ b/player/swfdec_debug_scripts.c
@@ -22,7 +22,7 @@
#endif
#include "swfdec_debug_scripts.h"
-#include <libswfdec/swfdec_script_internal.h>
+#include <swfdec/swfdec_script_internal.h>
G_DEFINE_TYPE (SwfdecDebugScripts, swfdec_debug_scripts, GTK_TYPE_TREE_VIEW)
diff --git a/player/swfdec_debug_scripts.h b/player/swfdec_debug_scripts.h
index b16dcc8..bfb65ff 100644
--- a/player/swfdec_debug_scripts.h
+++ b/player/swfdec_debug_scripts.h
@@ -21,7 +21,7 @@
#define _SWFDEC_DEBUG_SCRIPTS_H_
#include <gtk/gtk.h>
-#include <libswfdec/swfdec_debugger.h>
+#include <swfdec/swfdec_debugger.h>
G_BEGIN_DECLS
diff --git a/player/swfdec_debug_stack.c b/player/swfdec_debug_stack.c
index fa70b56..452ec0b 100644
--- a/player/swfdec_debug_stack.c
+++ b/player/swfdec_debug_stack.c
@@ -21,7 +21,7 @@
#include "config.h"
#endif
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
#include "swfdec_debug_stack.h"
G_DEFINE_TYPE (SwfdecDebugStack, swfdec_debug_stack, GTK_TYPE_TREE_VIEW)
diff --git a/player/swfdec_player_manager.c b/player/swfdec_player_manager.c
index 7eb1edc..9d67709 100644
--- a/player/swfdec_player_manager.c
+++ b/player/swfdec_player_manager.c
@@ -23,11 +23,11 @@
#include <stdlib.h>
#include <string.h>
-#include <libswfdec/swfdec_debugger.h>
-#include <libswfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_debugger.h>
+#include <swfdec/swfdec_as_object.h>
#include "swfdec_player_manager.h"
-#include <libswfdec/swfdec_script_internal.h>
-#include <libswfdec-gtk/swfdec_source.h>
+#include <swfdec/swfdec_script_internal.h>
+#include <swfdec-gtk/swfdec_source.h>
enum {
PROP_0,
diff --git a/player/swfdec_player_manager.h b/player/swfdec_player_manager.h
index d68ef3e..31e99a4 100644
--- a/player/swfdec_player_manager.h
+++ b/player/swfdec_player_manager.h
@@ -21,8 +21,8 @@
#define _SWFDEC_PLAYER_MANAGER_H_
#include <gtk/gtk.h>
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_debugger.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_debugger.h>
G_BEGIN_DECLS
diff --git a/player/swfplay.c b/player/swfplay.c
index 7f98bbe..1db23f3 100644
--- a/player/swfplay.c
+++ b/player/swfplay.c
@@ -22,9 +22,9 @@
#endif
#include <gtk/gtk.h>
#include <math.h>
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
-#include <libswfdec-gtk/swfdec-gtk.h>
+#include <swfdec-gtk/swfdec-gtk.h>
static GMainLoop *loop = NULL;
diff --git a/swfdec-gtk/Makefile.am b/swfdec-gtk/Makefile.am
index 4f724cf..2fdd027 100644
--- a/swfdec-gtk/Makefile.am
+++ b/swfdec-gtk/Makefile.am
@@ -29,7 +29,7 @@ libswfdec_gtk_ at SWFDEC_MAJORMINOR@_la_LDFLAGS = \
-version-info $(SWFDEC_LIBVERSION) \
-export-symbols-regex '^(swfdec_.*)' \
$(GTK_LIBS) $(SWFDEC_LIBS) $(AUDIO_LIBS)
-libswfdec_ at SWFDEC_MAJORMINOR@includedir = $(includedir)/swfdec- at SWFDEC_MAJORMINOR@/libswfdec-gtk
+libswfdec_ at SWFDEC_MAJORMINOR@includedir = $(includedir)/swfdec- at SWFDEC_MAJORMINOR@/swfdec-gtk
libswfdec_ at SWFDEC_MAJORMINOR@include_HEADERS = \
swfdec-gtk.h \
swfdec_gtk_keys.h \
diff --git a/swfdec-gtk/swfdec-gtk.h b/swfdec-gtk/swfdec-gtk.h
index b64cf83..1f5359f 100644
--- a/swfdec-gtk/swfdec-gtk.h
+++ b/swfdec-gtk/swfdec-gtk.h
@@ -20,10 +20,10 @@
#ifndef __SWFDEC_GTK_H__
#define __SWFDEC_GTK_H__
-#include <libswfdec-gtk/swfdec_gtk_keys.h>
-#include <libswfdec-gtk/swfdec_gtk_loader.h>
-#include <libswfdec-gtk/swfdec_gtk_player.h>
-#include <libswfdec-gtk/swfdec_gtk_socket.h>
-#include <libswfdec-gtk/swfdec_gtk_widget.h>
+#include <swfdec-gtk/swfdec_gtk_keys.h>
+#include <swfdec-gtk/swfdec_gtk_loader.h>
+#include <swfdec-gtk/swfdec_gtk_player.h>
+#include <swfdec-gtk/swfdec_gtk_socket.h>
+#include <swfdec-gtk/swfdec_gtk_widget.h>
#endif
diff --git a/swfdec-gtk/swfdec_gtk_keys.h b/swfdec-gtk/swfdec_gtk_keys.h
index d9b985b..f1aa55d 100644
--- a/swfdec-gtk/swfdec_gtk_keys.h
+++ b/swfdec-gtk/swfdec_gtk_keys.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_GTK_KEYS_H_
#define _SWFDEC_GTK_KEYS_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/swfdec-gtk/swfdec_gtk_loader.h b/swfdec-gtk/swfdec_gtk_loader.h
index ccae174..1e82f9f 100644
--- a/swfdec-gtk/swfdec_gtk_loader.h
+++ b/swfdec-gtk/swfdec_gtk_loader.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_GTK_LOADER_H_
#define _SWFDEC_GTK_LOADER_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/swfdec-gtk/swfdec_gtk_player.c b/swfdec-gtk/swfdec_gtk_player.c
index 6d0a0a3..71ff829 100644
--- a/swfdec-gtk/swfdec_gtk_player.c
+++ b/swfdec-gtk/swfdec_gtk_player.c
@@ -21,11 +21,11 @@
#include "config.h"
#endif
-#include "libswfdec-gtk/swfdec_gtk_loader.h"
-#include "libswfdec-gtk/swfdec_gtk_player.h"
-#include "libswfdec-gtk/swfdec_gtk_socket.h"
-#include "libswfdec-gtk/swfdec_playback.h"
-#include "libswfdec-gtk/swfdec_source.h"
+#include "swfdec-gtk/swfdec_gtk_loader.h"
+#include "swfdec-gtk/swfdec_gtk_player.h"
+#include "swfdec-gtk/swfdec_gtk_socket.h"
+#include "swfdec-gtk/swfdec_playback.h"
+#include "swfdec-gtk/swfdec_source.h"
struct _SwfdecGtkPlayer
{
diff --git a/swfdec-gtk/swfdec_gtk_player.h b/swfdec-gtk/swfdec_gtk_player.h
index 3ff77bf..dd4b51d 100644
--- a/swfdec-gtk/swfdec_gtk_player.h
+++ b/swfdec-gtk/swfdec_gtk_player.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_GTK_PLAYER_H_
#define _SWFDEC_GTK_PLAYER_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/swfdec-gtk/swfdec_gtk_socket.h b/swfdec-gtk/swfdec_gtk_socket.h
index 62bb546..c14a488 100644
--- a/swfdec-gtk/swfdec_gtk_socket.h
+++ b/swfdec-gtk/swfdec_gtk_socket.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_GTK_SOCKET_H_
#define _SWFDEC_GTK_SOCKET_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/swfdec-gtk/swfdec_gtk_widget.h b/swfdec-gtk/swfdec_gtk_widget.h
index 86b03fd..370fc20 100644
--- a/swfdec-gtk/swfdec_gtk_widget.h
+++ b/swfdec-gtk/swfdec_gtk_widget.h
@@ -21,7 +21,7 @@
#define _SWFDEC_GTK_WIDGET_H_
#include <gtk/gtk.h>
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/swfdec-gtk/swfdec_playback.h b/swfdec-gtk/swfdec_playback.h
index 8be67dd..0358293 100644
--- a/swfdec-gtk/swfdec_playback.h
+++ b/swfdec-gtk/swfdec_playback.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_PLAYBACK_H_
#define _SWFDEC_PLAYBACK_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/swfdec-gtk/swfdec_source.h b/swfdec-gtk/swfdec_source.h
index 0c7c383..b75077f 100644
--- a/swfdec-gtk/swfdec_source.h
+++ b/swfdec-gtk/swfdec_source.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_SOURCE_H_
#define _SWFDEC_SOURCE_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/swfdec/Makefile.am b/swfdec/Makefile.am
index dc62604..dccac20 100644
--- a/swfdec/Makefile.am
+++ b/swfdec/Makefile.am
@@ -199,7 +199,8 @@ public_headers = \
swfdec_url.h
libswfdec_ at SWFDEC_MAJORMINOR@_la_LIBADD = jpeg/libjpeg.la
-libswfdec_ at SWFDEC_MAJORMINOR@includedir = $(includedir)/swfdec- at SWFDEC_MAJORMINOR@/libswfdec
+
+libswfdec_ at SWFDEC_MAJORMINOR@includedir = $(includedir)/swfdec- at SWFDEC_MAJORMINOR@/swfdec
libswfdec_ at SWFDEC_MAJORMINOR@include_HEADERS = $(public_headers) swfdec_enums.h
noinst_HEADERS = \
diff --git a/swfdec/swfdec.h b/swfdec/swfdec.h
index e2432eb..1e769b3 100644
--- a/swfdec/swfdec.h
+++ b/swfdec/swfdec.h
@@ -22,27 +22,27 @@
#ifndef __SWFDEC_H__
#define __SWFDEC_H__
-#include <libswfdec/swfdec_as_context.h>
-#include <libswfdec/swfdec_as_debugger.h>
-#include <libswfdec/swfdec_as_frame.h>
-#include <libswfdec/swfdec_as_function.h>
-#include <libswfdec/swfdec_as_native_function.h>
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_script.h>
+#include <swfdec/swfdec_as_context.h>
+#include <swfdec/swfdec_as_debugger.h>
+#include <swfdec/swfdec_as_frame.h>
+#include <swfdec/swfdec_as_function.h>
+#include <swfdec/swfdec_as_native_function.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_script.h>
-#include <libswfdec/swfdec_audio.h>
-#include <libswfdec/swfdec_buffer.h>
-#include <libswfdec/swfdec_enums.h>
-#include <libswfdec/swfdec_file_loader.h>
-#include <libswfdec/swfdec_keys.h>
-#include <libswfdec/swfdec_loader.h>
-#include <libswfdec/swfdec_player.h>
-#include <libswfdec/swfdec_player_scripting.h>
-#include <libswfdec/swfdec_rectangle.h>
-#include <libswfdec/swfdec_socket.h>
-#include <libswfdec/swfdec_stream.h>
-#include <libswfdec/swfdec_system.h>
-#include <libswfdec/swfdec_url.h>
+#include <swfdec/swfdec_audio.h>
+#include <swfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_enums.h>
+#include <swfdec/swfdec_file_loader.h>
+#include <swfdec/swfdec_keys.h>
+#include <swfdec/swfdec_loader.h>
+#include <swfdec/swfdec_player.h>
+#include <swfdec/swfdec_player_scripting.h>
+#include <swfdec/swfdec_rectangle.h>
+#include <swfdec/swfdec_socket.h>
+#include <swfdec/swfdec_stream.h>
+#include <swfdec/swfdec_system.h>
+#include <swfdec/swfdec_url.h>
#endif
diff --git a/swfdec/swfdec_amf.h b/swfdec/swfdec_amf.h
index 0f9c67e..2b493dd 100644
--- a/swfdec/swfdec_amf.h
+++ b/swfdec/swfdec_amf.h
@@ -20,8 +20,8 @@
#ifndef __SWFDEC_AMF_H__
#define __SWFDEC_AMF_H__
-#include <libswfdec/swfdec_as_context.h>
-#include <libswfdec/swfdec_bits.h>
+#include <swfdec/swfdec_as_context.h>
+#include <swfdec/swfdec_bits.h>
typedef enum {
SWFDEC_AMF_NUMBER = 0,
diff --git a/swfdec/swfdec_as_array.h b/swfdec/swfdec_as_array.h
index 4c23a7f..22665a0 100644
--- a/swfdec/swfdec_as_array.h
+++ b/swfdec/swfdec_as_array.h
@@ -21,8 +21,8 @@
#ifndef _SWFDEC_AS_ARRAY_H_
#define _SWFDEC_AS_ARRAY_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_boolean.h b/swfdec/swfdec_as_boolean.h
index 723f076..7206da2 100644
--- a/swfdec/swfdec_as_boolean.h
+++ b/swfdec/swfdec_as_boolean.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_AS_BOOLEAN_H_
#define _SWFDEC_AS_BOOLEAN_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_context.h b/swfdec/swfdec_as_context.h
index d5ef066..3b19a7e 100644
--- a/swfdec/swfdec_as_context.h
+++ b/swfdec/swfdec_as_context.h
@@ -21,7 +21,7 @@
#define _SWFDEC_AS_CONTEXT_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_date.h b/swfdec/swfdec_as_date.h
index b095520..77d4eab 100644
--- a/swfdec/swfdec_as_date.h
+++ b/swfdec/swfdec_as_date.h
@@ -21,9 +21,9 @@
#ifndef _SWFDEC_AS_DATE_H_
#define _SWFDEC_AS_DATE_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_script.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_script.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_debugger.h b/swfdec/swfdec_as_debugger.h
index 2e2c0e7..3cd4b4f 100644
--- a/swfdec/swfdec_as_debugger.h
+++ b/swfdec/swfdec_as_debugger.h
@@ -20,9 +20,9 @@
#ifndef _SWFDEC_AS_DEBUGGER_H_
#define _SWFDEC_AS_DEBUGGER_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_script.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_script.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_frame.h b/swfdec/swfdec_as_frame.h
index 344eaa7..db58580 100644
--- a/swfdec/swfdec_as_frame.h
+++ b/swfdec/swfdec_as_frame.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_AS_FRAME_H_
#define _SWFDEC_AS_FRAME_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_frame_internal.h b/swfdec/swfdec_as_frame_internal.h
index 866d1fa..07175a1 100644
--- a/swfdec/swfdec_as_frame_internal.h
+++ b/swfdec/swfdec_as_frame_internal.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_AS_FRAME_INTERNAL_H_
#define _SWFDEC_AS_FRAME_INTERNAL_H_
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_script_internal.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_script_internal.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_function.h b/swfdec/swfdec_as_function.h
index 534aad5..fbc461d 100644
--- a/swfdec/swfdec_as_function.h
+++ b/swfdec/swfdec_as_function.h
@@ -20,9 +20,9 @@
#ifndef _SWFDEC_AS_FUNCTION_H_
#define _SWFDEC_AS_FUNCTION_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_script.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_script.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_internal.h b/swfdec/swfdec_as_internal.h
index 30a556c..7b634d7 100644
--- a/swfdec/swfdec_as_internal.h
+++ b/swfdec/swfdec_as_internal.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_AS_INTERNAL_H_
#define _SWFDEC_AS_INTERNAL_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_interpret.h b/swfdec/swfdec_as_interpret.h
index 6b9402b..09201dd 100644
--- a/swfdec/swfdec_as_interpret.h
+++ b/swfdec/swfdec_as_interpret.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_AS_INTERPRET_H_
#define _SWFDEC_AS_INTERPRET_H_
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_native_function.h b/swfdec/swfdec_as_native_function.h
index 88c172d..8089e5b 100644
--- a/swfdec/swfdec_as_native_function.h
+++ b/swfdec/swfdec_as_native_function.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_AS_NATIVE_FUNCTION_H_
#define _SWFDEC_AS_NATIVE_FUNCTION_H_
-#include <libswfdec/swfdec_as_function.h>
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_function.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_number.h b/swfdec/swfdec_as_number.h
index 9b6ede0..eeb1c1c 100644
--- a/swfdec/swfdec_as_number.h
+++ b/swfdec/swfdec_as_number.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_AS_NUMBER_H_
#define _SWFDEC_AS_NUMBER_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_object.h b/swfdec/swfdec_as_object.h
index 2fe888f..d8fcf32 100644
--- a/swfdec/swfdec_as_object.h
+++ b/swfdec/swfdec_as_object.h
@@ -21,7 +21,7 @@
#define _SWFDEC_AS_OBJECT_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_script_function.h b/swfdec/swfdec_as_script_function.h
index 1972e15..ab04a72 100644
--- a/swfdec/swfdec_as_script_function.h
+++ b/swfdec/swfdec_as_script_function.h
@@ -20,9 +20,9 @@
#ifndef _SWFDEC_AS_SCRIPT_FUNCTION_H_
#define _SWFDEC_AS_SCRIPT_FUNCTION_H_
-#include <libswfdec/swfdec_as_function.h>
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_script.h>
+#include <swfdec/swfdec_as_function.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_script.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_stack.h b/swfdec/swfdec_as_stack.h
index 26e66ea..644095c 100644
--- a/swfdec/swfdec_as_stack.h
+++ b/swfdec/swfdec_as_stack.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_AS_STACK_H_
#define _SWFDEC_AS_STACK_H_
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
@@ -36,7 +36,7 @@ void swfdec_as_stack_pop_segment (SwfdecAsContext * context);
//#define SWFDEC_MAD_CHECKS
#ifdef SWFDEC_MAD_CHECKS
-#include <libswfdec/swfdec_as_context.h>
+#include <swfdec/swfdec_as_context.h>
static inline SwfdecAsValue *
swfdec_as_stack_peek (SwfdecAsContext *cx, guint n)
{
diff --git a/swfdec/swfdec_as_string.h b/swfdec/swfdec_as_string.h
index c0cd621..915ced0 100644
--- a/swfdec/swfdec_as_string.h
+++ b/swfdec/swfdec_as_string.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_AS_STRING_H_
#define _SWFDEC_AS_STRING_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_super.h b/swfdec/swfdec_as_super.h
index ad082e9..a1a8e6a 100644
--- a/swfdec/swfdec_as_super.h
+++ b/swfdec/swfdec_as_super.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_AS_SUPER_H_
#define _SWFDEC_AS_SUPER_H_
-#include <libswfdec/swfdec_as_function.h>
-#include <libswfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_as_function.h>
+#include <swfdec/swfdec_as_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_audio_event.h b/swfdec/swfdec_audio_event.h
index 40a0eb6..b2e3d6c 100644
--- a/swfdec/swfdec_audio_event.h
+++ b/swfdec/swfdec_audio_event.h
@@ -22,8 +22,8 @@
#ifndef _SWFDEC_AUDIO_EVENT_H_
#define _SWFDEC_AUDIO_EVENT_H_
-#include <libswfdec/swfdec_audio_internal.h>
-#include <libswfdec/swfdec_sound.h>
+#include <swfdec/swfdec_audio_internal.h>
+#include <swfdec/swfdec_sound.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_audio_flv.h b/swfdec/swfdec_audio_flv.h
index 52ac2a5..91671f7 100644
--- a/swfdec/swfdec_audio_flv.h
+++ b/swfdec/swfdec_audio_flv.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_AUDIO_FLV_H_
#define _SWFDEC_AUDIO_FLV_H_
-#include <libswfdec/swfdec_audio_internal.h>
-#include <libswfdec/swfdec_flv_decoder.h>
+#include <swfdec/swfdec_audio_internal.h>
+#include <swfdec/swfdec_flv_decoder.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_audio_internal.h b/swfdec/swfdec_audio_internal.h
index 512f6e7..2332baa 100644
--- a/swfdec/swfdec_audio_internal.h
+++ b/swfdec/swfdec_audio_internal.h
@@ -22,10 +22,10 @@
#ifndef _SWFDEC_AUDIO_INTERNAL_H_
#define _SWFDEC_AUDIO_INTERNAL_H_
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_audio.h>
-#include <libswfdec/swfdec_bits.h>
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_audio.h>
+#include <swfdec/swfdec_bits.h>
+#include <swfdec/swfdec_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_audio_stream.h b/swfdec/swfdec_audio_stream.h
index 306c9c8..5d7c531 100644
--- a/swfdec/swfdec_audio_stream.h
+++ b/swfdec/swfdec_audio_stream.h
@@ -22,8 +22,8 @@
#ifndef _SWFDEC_AUDIO_STREAM_H_
#define _SWFDEC_AUDIO_STREAM_H_
-#include <libswfdec/swfdec_audio_internal.h>
-#include <libswfdec/swfdec_codec_audio.h>
+#include <swfdec/swfdec_audio_internal.h>
+#include <swfdec/swfdec_codec_audio.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_bits.h b/swfdec/swfdec_bits.h
index c56bc99..36e9a6a 100644
--- a/swfdec/swfdec_bits.h
+++ b/swfdec/swfdec_bits.h
@@ -23,8 +23,8 @@
#define __SWFDEC_BITS_H__
#include <cairo.h>
-#include <libswfdec/swfdec_color.h>
-#include <libswfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_color.h>
+#include <swfdec/swfdec_buffer.h>
typedef struct _SwfdecBits SwfdecBits;
diff --git a/swfdec/swfdec_button.h b/swfdec/swfdec_button.h
index ddf5900..b69ed5a 100644
--- a/swfdec/swfdec_button.h
+++ b/swfdec/swfdec_button.h
@@ -22,8 +22,8 @@
#ifndef _SWFDEC_BUTTON_H_
#define _SWFDEC_BUTTON_H_
-#include <libswfdec/swfdec_graphic.h>
-#include <libswfdec/swfdec_color.h>
+#include <swfdec/swfdec_graphic.h>
+#include <swfdec/swfdec_color.h>
G_BEGIN_DECLS
//typedef struct _SwfdecButton SwfdecButton;
diff --git a/swfdec/swfdec_button_movie.h b/swfdec/swfdec_button_movie.h
index 1f6dfaf..3c3ded4 100644
--- a/swfdec/swfdec_button_movie.h
+++ b/swfdec/swfdec_button_movie.h
@@ -21,8 +21,8 @@
#define _SWFDEC_BUTTON_MOVIE_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_movie.h>
-#include <libswfdec/swfdec_button.h>
+#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_button.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_cache.h b/swfdec/swfdec_cache.h
index 5e58aa4..89b589d 100644
--- a/swfdec/swfdec_cache.h
+++ b/swfdec/swfdec_cache.h
@@ -21,7 +21,7 @@
#ifndef _SWFDEC_CACHE_H_
#define _SWFDEC_CACHE_H_
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_cached.h b/swfdec/swfdec_cached.h
index bc9a1f7..52365f4 100644
--- a/swfdec/swfdec_cached.h
+++ b/swfdec/swfdec_cached.h
@@ -21,8 +21,8 @@
#define _SWFDEC_CACHED_H_
#include <cairo.h>
-#include <libswfdec/swfdec_cache.h>
-#include <libswfdec/swfdec_character.h>
+#include <swfdec/swfdec_cache.h>
+#include <swfdec/swfdec_character.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_character.h b/swfdec/swfdec_character.h
index 50b577b..e884887 100644
--- a/swfdec/swfdec_character.h
+++ b/swfdec/swfdec_character.h
@@ -23,8 +23,8 @@
#define _SWFDEC_CHARACTER_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_rect.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_rect.h>
G_BEGIN_DECLS
//typedef struct _SwfdecCharacter SwfdecCharacter;
diff --git a/swfdec/swfdec_codec_audio.h b/swfdec/swfdec_codec_audio.h
index 48eb139..6f9e4f9 100644
--- a/swfdec/swfdec_codec_audio.h
+++ b/swfdec/swfdec_codec_audio.h
@@ -21,8 +21,8 @@
#define _SWFDEC_CODEC_H_
#include <glib.h>
-#include <libswfdec/swfdec_audio_internal.h>
-#include <libswfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_audio_internal.h>
+#include <swfdec/swfdec_buffer.h>
typedef struct _SwfdecAudioDecoder SwfdecAudioDecoder;
diff --git a/swfdec/swfdec_codec_video.h b/swfdec/swfdec_codec_video.h
index a7c968a..c58fd03 100644
--- a/swfdec/swfdec_codec_video.h
+++ b/swfdec/swfdec_codec_video.h
@@ -22,7 +22,7 @@
#include <glib.h>
#include <cairo.h>
-#include <libswfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_buffer.h>
#define SWFDEC_VIDEO_CODEC_UNDEFINED 0
#define SWFDEC_VIDEO_CODEC_H263 2
diff --git a/swfdec/swfdec_color.h b/swfdec/swfdec_color.h
index d2ba7a1..188e6dd 100644
--- a/swfdec/swfdec_color.h
+++ b/swfdec/swfdec_color.h
@@ -22,7 +22,7 @@
#ifndef __SWFDEC_COLOR_H__
#define __SWFDEC_COLOR_H__
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec_types.h>
struct _SwfdecColorTransform {
gboolean mask; /* TRUE if this is a mask - masks are always black */
diff --git a/swfdec/swfdec_debugger.h b/swfdec/swfdec_debugger.h
index 139e93b..00999ba 100644
--- a/swfdec/swfdec_debugger.h
+++ b/swfdec/swfdec_debugger.h
@@ -21,10 +21,10 @@
#define _SWFDEC_DEBUGGER_H_
#include <glib-object.h>
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_player_internal.h>
-#include <libswfdec/swfdec_script.h>
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_player_internal.h>
+#include <swfdec/swfdec_script.h>
+#include <swfdec/swfdec_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_decoder.h b/swfdec/swfdec_decoder.h
index 3a58015..1dc762c 100644
--- a/swfdec/swfdec_decoder.h
+++ b/swfdec/swfdec_decoder.h
@@ -21,10 +21,10 @@
#define _SWFDEC_DECODER_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_buffer.h>
-#include <libswfdec/swfdec_loader.h>
-#include <libswfdec/swfdec_player.h>
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_loader.h>
+#include <swfdec/swfdec_player.h>
+#include <swfdec/swfdec_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_draw.h b/swfdec/swfdec_draw.h
index e56a4ae..a892e47 100644
--- a/swfdec/swfdec_draw.h
+++ b/swfdec/swfdec_draw.h
@@ -22,8 +22,8 @@
#include <glib-object.h>
#include <cairo.h>
-#include <libswfdec/swfdec_swf_decoder.h>
-#include <libswfdec/swfdec_color.h>
+#include <swfdec/swfdec_swf_decoder.h>
+#include <swfdec/swfdec_color.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_event.h b/swfdec/swfdec_event.h
index 4b1ba40..ed13327 100644
--- a/swfdec/swfdec_event.h
+++ b/swfdec/swfdec_event.h
@@ -17,10 +17,10 @@
* Boston, MA 02110-1301 USA
*/
-#include <libswfdec/swfdec_bits.h>
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_player.h>
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec_bits.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_player.h>
+#include <swfdec/swfdec_types.h>
#ifndef _SWFDEC_EVENT_H_
#define _SWFDEC_EVENT_H_
diff --git a/swfdec/swfdec_file_loader.h b/swfdec/swfdec_file_loader.h
index facd8c5..8350063 100644
--- a/swfdec/swfdec_file_loader.h
+++ b/swfdec/swfdec_file_loader.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_FILE_LOADER_H_
#define _SWFDEC_FILE_LOADER_H_
-#include <libswfdec/swfdec_loader.h>
+#include <swfdec/swfdec_loader.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_filter.h b/swfdec/swfdec_filter.h
index 2f39f15..ff0ce72 100644
--- a/swfdec/swfdec_filter.h
+++ b/swfdec/swfdec_filter.h
@@ -20,10 +20,10 @@
#ifndef _SWFDEC_FILTER_H_
#define _SWFDEC_FILTER_H_
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_bits.h>
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_bits.h>
+#include <swfdec/swfdec_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_flv_decoder.h b/swfdec/swfdec_flv_decoder.h
index 635fea4..0061c02 100644
--- a/swfdec/swfdec_flv_decoder.h
+++ b/swfdec/swfdec_flv_decoder.h
@@ -20,9 +20,9 @@
#ifndef __SWFDEC_FLV_DECODER_H__
#define __SWFDEC_FLV_DECODER_H__
-#include <libswfdec/swfdec_codec_audio.h>
-#include <libswfdec/swfdec_codec_video.h>
-#include <libswfdec/swfdec_decoder.h>
+#include <swfdec/swfdec_codec_audio.h>
+#include <swfdec/swfdec_codec_video.h>
+#include <swfdec/swfdec_decoder.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_font.h b/swfdec/swfdec_font.h
index b9ff5d7..a34eb39 100644
--- a/swfdec/swfdec_font.h
+++ b/swfdec/swfdec_font.h
@@ -23,8 +23,8 @@
#define _SWFDEC_FONT_H_
#include <pango/pangocairo.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_character.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_character.h>
G_BEGIN_DECLS
//typedef struct _SwfdecFont SwfdecFont;
diff --git a/swfdec/swfdec_gradient_pattern.h b/swfdec/swfdec_gradient_pattern.h
index 6b85608..b025314 100644
--- a/swfdec/swfdec_gradient_pattern.h
+++ b/swfdec/swfdec_gradient_pattern.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_GRADIENT_PATTERN_H_
#define _SWFDEC_GRADIENT_PATTERN_H_
-#include <libswfdec/swfdec_pattern.h>
+#include <swfdec/swfdec_pattern.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_graphic.h b/swfdec/swfdec_graphic.h
index 0b48d19..52e0f74 100644
--- a/swfdec/swfdec_graphic.h
+++ b/swfdec/swfdec_graphic.h
@@ -23,9 +23,9 @@
#define _SWFDEC_GRAPHIC_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_character.h>
-#include <libswfdec/swfdec_rect.h>
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec_character.h>
+#include <swfdec/swfdec_rect.h>
+#include <swfdec/swfdec_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_graphic_movie.h b/swfdec/swfdec_graphic_movie.h
index 4d6e454..ede8a0f 100644
--- a/swfdec/swfdec_graphic_movie.h
+++ b/swfdec/swfdec_graphic_movie.h
@@ -21,8 +21,8 @@
#define _SWFDEC_GRAPHIC_MOVIE_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_movie.h>
-#include <libswfdec/swfdec_graphic.h>
+#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_graphic.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_image.h b/swfdec/swfdec_image.h
index e648e08..8e41db9 100644
--- a/swfdec/swfdec_image.h
+++ b/swfdec/swfdec_image.h
@@ -23,8 +23,8 @@
#define _SWFDEC_IMAGE_H_
#include <cairo.h>
-#include <libswfdec/swfdec_cached.h>
-#include <libswfdec/swfdec_decoder.h>
+#include <swfdec/swfdec_cached.h>
+#include <swfdec/swfdec_decoder.h>
G_BEGIN_DECLS
//typedef struct _SwfdecImage SwfdecImage;
diff --git a/swfdec/swfdec_image_decoder.h b/swfdec/swfdec_image_decoder.h
index b5f3a84..0b3f743 100644
--- a/swfdec/swfdec_image_decoder.h
+++ b/swfdec/swfdec_image_decoder.h
@@ -22,10 +22,10 @@
#include <glib.h>
-#include <libswfdec/swfdec_decoder.h>
-#include <libswfdec/swfdec_bits.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_rect.h>
+#include <swfdec/swfdec_decoder.h>
+#include <swfdec/swfdec_bits.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_rect.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_internal.h b/swfdec/swfdec_internal.h
index 79d49c1..41d8664 100644
--- a/swfdec/swfdec_internal.h
+++ b/swfdec/swfdec_internal.h
@@ -22,9 +22,9 @@
#ifndef _SWFDEC_INTERNAL_H_
#define _SWFDEC_INTERNAL_H_
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_codec_audio.h>
-#include <libswfdec/swfdec_codec_video.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_codec_audio.h>
+#include <swfdec/swfdec_codec_video.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_interval.h b/swfdec/swfdec_interval.h
index 48941bf..8e82511 100644
--- a/swfdec/swfdec_interval.h
+++ b/swfdec/swfdec_interval.h
@@ -20,10 +20,10 @@
#ifndef _SWFDEC_INTERVAL_H_
#define _SWFDEC_INTERVAL_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_player_internal.h>
-#include <libswfdec/swfdec_sandbox.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_player_internal.h>
+#include <swfdec/swfdec_sandbox.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_load_object.h b/swfdec/swfdec_load_object.h
index 51b3baa..cd899a9 100644
--- a/swfdec/swfdec_load_object.h
+++ b/swfdec/swfdec_load_object.h
@@ -21,9 +21,9 @@
#ifndef _SWFDEC_LOAD_OBJECT_H_
#define _SWFDEC_LOAD_OBJECT_H_
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_resource.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_resource.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_loader.h b/swfdec/swfdec_loader.h
index 3d0ebff..6f15477 100644
--- a/swfdec/swfdec_loader.h
+++ b/swfdec/swfdec_loader.h
@@ -21,10 +21,10 @@
#define _SWFDEC_LOADER_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_buffer.h>
-#include <libswfdec/swfdec_player.h>
-#include <libswfdec/swfdec_stream.h>
-#include <libswfdec/swfdec_url.h>
+#include <swfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_player.h>
+#include <swfdec/swfdec_stream.h>
+#include <swfdec/swfdec_url.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_morph_movie.h b/swfdec/swfdec_morph_movie.h
index c8dd6cc..db19692 100644
--- a/swfdec/swfdec_morph_movie.h
+++ b/swfdec/swfdec_morph_movie.h
@@ -21,8 +21,8 @@
#define _SWFDEC_MORPH_MOVIE_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_movie.h>
-#include <libswfdec/swfdec_morphshape.h>
+#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_morphshape.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_morphshape.h b/swfdec/swfdec_morphshape.h
index e460109..8a5107e 100644
--- a/swfdec/swfdec_morphshape.h
+++ b/swfdec/swfdec_morphshape.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_MORPH_SHAPE_H_
#define _SWFDEC_MORPH_SHAPE_H_
-#include <libswfdec/swfdec_shape.h>
+#include <swfdec/swfdec_shape.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_movie.h b/swfdec/swfdec_movie.h
index 623707f..296e495 100644
--- a/swfdec/swfdec_movie.h
+++ b/swfdec/swfdec_movie.h
@@ -21,12 +21,12 @@
#define _SWFDEC_MOVIE_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_color.h>
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_event.h>
-#include <libswfdec/swfdec_rect.h>
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_color.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_event.h>
+#include <swfdec/swfdec_rect.h>
+#include <swfdec/swfdec_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_movie_clip_loader.h b/swfdec/swfdec_movie_clip_loader.h
index 9ef0d1c..5bf7aae 100644
--- a/swfdec/swfdec_movie_clip_loader.h
+++ b/swfdec/swfdec_movie_clip_loader.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_MOVIE_CLIP_LOADER_H_
#define _SWFDEC_MOVIE_CLIP_LOADER_H_
-#include <libswfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_object.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_net_connection.h b/swfdec/swfdec_net_connection.h
index e7bd3fa..c14daac 100644
--- a/swfdec/swfdec_net_connection.h
+++ b/swfdec/swfdec_net_connection.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_NET_CONNECTION_H_
#define _SWFDEC_NET_CONNECTION_H_
-#include <libswfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_object.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_net_stream.h b/swfdec/swfdec_net_stream.h
index 943c834..5520d05 100644
--- a/swfdec/swfdec_net_stream.h
+++ b/swfdec/swfdec_net_stream.h
@@ -20,14 +20,14 @@
#ifndef _SWFDEC_NET_STREAM_H_
#define _SWFDEC_NET_STREAM_H_
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_codec_video.h>
-#include <libswfdec/swfdec_net_connection.h>
-#include <libswfdec/swfdec_flv_decoder.h>
-#include <libswfdec/swfdec_player_internal.h>
-#include <libswfdec/swfdec_sandbox.h>
-#include <libswfdec/swfdec_video_movie.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_codec_video.h>
+#include <swfdec/swfdec_net_connection.h>
+#include <swfdec/swfdec_flv_decoder.h>
+#include <swfdec/swfdec_player_internal.h>
+#include <swfdec/swfdec_sandbox.h>
+#include <swfdec/swfdec_video_movie.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_path.h b/swfdec/swfdec_path.h
index 502a049..bfe0607 100644
--- a/swfdec/swfdec_path.h
+++ b/swfdec/swfdec_path.h
@@ -21,7 +21,7 @@
#define _SWFDEC_PATH_H_
#include <cairo.h>
-#include <libswfdec/swfdec_rect.h>
+#include <swfdec/swfdec_rect.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_pattern.h b/swfdec/swfdec_pattern.h
index 3fdcf99..811389d 100644
--- a/swfdec/swfdec_pattern.h
+++ b/swfdec/swfdec_pattern.h
@@ -22,8 +22,8 @@
#include <glib-object.h>
#include <cairo.h>
-#include <libswfdec/swfdec_draw.h>
-#include <libswfdec/swfdec_swf_decoder.h>
+#include <swfdec/swfdec_draw.h>
+#include <swfdec/swfdec_swf_decoder.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_player.h b/swfdec/swfdec_player.h
index b3ec5f5..5c32f59 100644
--- a/swfdec/swfdec_player.h
+++ b/swfdec/swfdec_player.h
@@ -22,9 +22,9 @@
#include <glib-object.h>
#include <cairo.h>
-#include <libswfdec/swfdec_as_context.h>
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_url.h>
+#include <swfdec/swfdec_as_context.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_url.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_player_internal.h b/swfdec/swfdec_player_internal.h
index a38b957..453ce3d 100644
--- a/swfdec/swfdec_player_internal.h
+++ b/swfdec/swfdec_player_internal.h
@@ -20,16 +20,16 @@
#ifndef _SWFDEC_PLAYER_INTERNAL_H_
#define _SWFDEC_PLAYER_INTERNAL_H_
-#include <libswfdec/swfdec_player.h>
-#include <libswfdec/swfdec_audio.h>
-#include <libswfdec/swfdec_event.h>
-#include <libswfdec/swfdec_function_list.h>
-#include <libswfdec/swfdec_loader.h>
-#include <libswfdec/swfdec_player_scripting.h>
-#include <libswfdec/swfdec_rect.h>
-#include <libswfdec/swfdec_ringbuffer.h>
-#include <libswfdec/swfdec_socket.h>
-#include <libswfdec/swfdec_system.h>
+#include <swfdec/swfdec_player.h>
+#include <swfdec/swfdec_audio.h>
+#include <swfdec/swfdec_event.h>
+#include <swfdec/swfdec_function_list.h>
+#include <swfdec/swfdec_loader.h>
+#include <swfdec/swfdec_player_scripting.h>
+#include <swfdec/swfdec_rect.h>
+#include <swfdec/swfdec_ringbuffer.h>
+#include <swfdec/swfdec_socket.h>
+#include <swfdec/swfdec_system.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_player_scripting.h b/swfdec/swfdec_player_scripting.h
index 8ad3c8f..03dbbae 100644
--- a/swfdec/swfdec_player_scripting.h
+++ b/swfdec/swfdec_player_scripting.h
@@ -21,7 +21,7 @@
#define _SWFDEC_PLAYER_SCRIPTING_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_player.h>
+#include <swfdec/swfdec_player.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_policy_file.h b/swfdec/swfdec_policy_file.h
index b849562..337e236 100644
--- a/swfdec/swfdec_policy_file.h
+++ b/swfdec/swfdec_policy_file.h
@@ -21,8 +21,8 @@
#ifndef _SWFDEC_FLASH_SECURITY_POLICY_H_
#define _SWFDEC_FLASH_SECURITY_POLICY_H_
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_player.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_player.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_rect.h b/swfdec/swfdec_rect.h
index d43cee4..6833b8c 100644
--- a/swfdec/swfdec_rect.h
+++ b/swfdec/swfdec_rect.h
@@ -22,8 +22,8 @@
#ifndef __SWFDEC_RECT_H__
#define __SWFDEC_RECT_H__
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_rectangle.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_rectangle.h>
struct _SwfdecRect
{
diff --git a/swfdec/swfdec_resource.h b/swfdec/swfdec_resource.h
index fba2f95..3496789 100644
--- a/swfdec/swfdec_resource.h
+++ b/swfdec/swfdec_resource.h
@@ -20,9 +20,9 @@
#ifndef _SWFDEC_RESOURCE_H_
#define _SWFDEC_RESOURCE_H_
-#include <libswfdec/swfdec_player.h>
-#include <libswfdec/swfdec_sandbox.h>
-#include <libswfdec/swfdec_sprite_movie.h>
+#include <swfdec/swfdec_player.h>
+#include <swfdec/swfdec_sandbox.h>
+#include <swfdec/swfdec_sprite_movie.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_sandbox.h b/swfdec/swfdec_sandbox.h
index 6fda9b7..fa5baca 100644
--- a/swfdec/swfdec_sandbox.h
+++ b/swfdec/swfdec_sandbox.h
@@ -20,9 +20,9 @@
#ifndef _SWFDEC_SANDBOX_H_
#define _SWFDEC_SANDBOX_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_url.h>
-#include <libswfdec/swfdec_player.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_url.h>
+#include <swfdec/swfdec_player.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_script.h b/swfdec/swfdec_script.h
index fe90428..0881831 100644
--- a/swfdec/swfdec_script.h
+++ b/swfdec/swfdec_script.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_SCRIPT_H_
#define _SWFDEC_SCRIPT_H_
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_buffer.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_script_internal.h b/swfdec/swfdec_script_internal.h
index 23acb0d..8dc4308 100644
--- a/swfdec/swfdec_script_internal.h
+++ b/swfdec/swfdec_script_internal.h
@@ -20,10 +20,10 @@
#ifndef _SWFDEC_SCRIPT_INTERNAL_H_
#define _SWFDEC_SCRIPT_INTERNAL_H_
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_bits.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_bits.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_shape.h b/swfdec/swfdec_shape.h
index 312dc9f..b97189c 100644
--- a/swfdec/swfdec_shape.h
+++ b/swfdec/swfdec_shape.h
@@ -22,13 +22,13 @@
#ifndef _SWFDEC_SHAPE_H_
#define _SWFDEC_SHAPE_H_
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_color.h>
-#include <libswfdec/swfdec_bits.h>
-#include <libswfdec/swfdec_graphic.h>
-#include <libswfdec/swfdec_pattern.h>
-#include <libswfdec/swfdec_stroke.h>
-#include <libswfdec/swfdec_swf_decoder.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_color.h>
+#include <swfdec/swfdec_bits.h>
+#include <swfdec/swfdec_graphic.h>
+#include <swfdec/swfdec_pattern.h>
+#include <swfdec/swfdec_stroke.h>
+#include <swfdec/swfdec_swf_decoder.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_shape_parser.h b/swfdec/swfdec_shape_parser.h
index 9dccbf0..75e3ee5 100644
--- a/swfdec/swfdec_shape_parser.h
+++ b/swfdec/swfdec_shape_parser.h
@@ -22,8 +22,8 @@
#ifndef _SWFDEC_SHAPE_PARSER_H_
#define _SWFDEC_SHAPE_PARSER_H_
-#include <libswfdec/swfdec_bits.h>
-#include <libswfdec/swfdec_draw.h>
+#include <swfdec/swfdec_bits.h>
+#include <swfdec/swfdec_draw.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_socket.c b/swfdec/swfdec_socket.c
index 723050c..c02c790 100644
--- a/swfdec/swfdec_socket.c
+++ b/swfdec/swfdec_socket.c
@@ -34,7 +34,7 @@
* SwfdecSockets are used to implement TCP streams. These are for example used
* to implement RTMP support or the XMLSocket script class. Backends are
* supposed to provide an implementation for this, as by default this class is
- * unimplemented. However, libswfdec-gtk or other convenience libraries provide
+ * unimplemented. However, swfdec-gtk or other convenience libraries provide
* a socket implementation by default.
*
* The socket implementation used by a #SwfdecPlayer can be set with the
diff --git a/swfdec/swfdec_socket.h b/swfdec/swfdec_socket.h
index 7e062ca..ca750af 100644
--- a/swfdec/swfdec_socket.h
+++ b/swfdec/swfdec_socket.h
@@ -21,7 +21,7 @@
#define _SWFDEC_SOCKET_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_stream.h>
+#include <swfdec/swfdec_stream.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_sound.h b/swfdec/swfdec_sound.h
index 75e917e..cea0a58 100644
--- a/swfdec/swfdec_sound.h
+++ b/swfdec/swfdec_sound.h
@@ -22,10 +22,10 @@
#ifndef _SWFDEC_SOUND_H_
#define _SWFDEC_SOUND_H_
-#include <libswfdec/swfdec_cached.h>
-#include <libswfdec/swfdec_codec_audio.h>
-#include <libswfdec/swfdec_swf_decoder.h>
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec_cached.h>
+#include <swfdec/swfdec_codec_audio.h>
+#include <swfdec/swfdec_swf_decoder.h>
+#include <swfdec/swfdec_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_sound_object.h b/swfdec/swfdec_sound_object.h
index cdceaeb..c36d12e 100644
--- a/swfdec/swfdec_sound_object.h
+++ b/swfdec/swfdec_sound_object.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_SOUND_OBJECT_H_
#define _SWFDEC_SOUND_OBJECT_H_
-#include <libswfdec/swfdec_movie.h>
+#include <swfdec/swfdec_movie.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_sprite.h b/swfdec/swfdec_sprite.h
index 6c9d4b9..cbca787 100644
--- a/swfdec/swfdec_sprite.h
+++ b/swfdec/swfdec_sprite.h
@@ -22,10 +22,10 @@
#ifndef _SWFDEC_SPRITE_H_
#define _SWFDEC_SPRITE_H_
-#include <libswfdec/swfdec_color.h>
-#include <libswfdec/swfdec_event.h>
-#include <libswfdec/swfdec_graphic.h>
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec_color.h>
+#include <swfdec/swfdec_event.h>
+#include <swfdec/swfdec_graphic.h>
+#include <swfdec/swfdec_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_sprite_movie.h b/swfdec/swfdec_sprite_movie.h
index 093154d..93fe320 100644
--- a/swfdec/swfdec_sprite_movie.h
+++ b/swfdec/swfdec_sprite_movie.h
@@ -20,9 +20,9 @@
#ifndef _SWFDEC_SPRITE_MOVIE_H_
#define _SWFDEC_SPRITE_MOVIE_H_
-#include <libswfdec/swfdec_movie.h>
-#include <libswfdec/swfdec_audio.h>
-#include <libswfdec/swfdec_types.h>
+#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_audio.h>
+#include <swfdec/swfdec_types.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_stream.h b/swfdec/swfdec_stream.h
index f1cb86c..973863d 100644
--- a/swfdec/swfdec_stream.h
+++ b/swfdec/swfdec_stream.h
@@ -21,7 +21,7 @@
#define _SWFDEC_STREAM_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_buffer.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_stream_target.h b/swfdec/swfdec_stream_target.h
index 42b8e16..9f0ddff 100644
--- a/swfdec/swfdec_stream_target.h
+++ b/swfdec/swfdec_stream_target.h
@@ -20,7 +20,7 @@
#ifndef __SWFDEC_STREAM_TARGET_H__
#define __SWFDEC_STREAM_TARGET_H__
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_stroke.h b/swfdec/swfdec_stroke.h
index 8d1e7cd..01c2eba 100644
--- a/swfdec/swfdec_stroke.h
+++ b/swfdec/swfdec_stroke.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_STROKE_H_
#define _SWFDEC_STROKE_H_
-#include <libswfdec/swfdec_pattern.h>
+#include <swfdec/swfdec_pattern.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_style_sheet.h b/swfdec/swfdec_style_sheet.h
index 847d7f7..226ff87 100644
--- a/swfdec/swfdec_style_sheet.h
+++ b/swfdec/swfdec_style_sheet.h
@@ -21,10 +21,10 @@
#ifndef _SWFDEC_STYLESHEET_H_
#define _SWFDEC_STYLESHEET_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_script.h>
-#include <libswfdec/swfdec_text_format.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_script.h>
+#include <swfdec/swfdec_text_format.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_swf_decoder.h b/swfdec/swfdec_swf_decoder.h
index dcd2e16..0566c99 100644
--- a/swfdec/swfdec_swf_decoder.h
+++ b/swfdec/swfdec_swf_decoder.h
@@ -25,10 +25,10 @@
#include <glib.h>
#include <zlib.h>
-#include <libswfdec/swfdec_decoder.h>
-#include <libswfdec/swfdec_bits.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_rect.h>
+#include <swfdec/swfdec_decoder.h>
+#include <swfdec/swfdec_bits.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_rect.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_text.h b/swfdec/swfdec_text.h
index a590470..867e6f4 100644
--- a/swfdec/swfdec_text.h
+++ b/swfdec/swfdec_text.h
@@ -22,8 +22,8 @@
#ifndef _SWFDEC_TEXT_H_
#define _SWFDEC_TEXT_H_
-#include <libswfdec/swfdec_graphic.h>
-#include <libswfdec/swfdec_color.h>
+#include <swfdec/swfdec_graphic.h>
+#include <swfdec/swfdec_color.h>
G_BEGIN_DECLS
//typedef struct _SwfdecText SwfdecText;
diff --git a/swfdec/swfdec_text_field.h b/swfdec/swfdec_text_field.h
index a321a1c..2ad0414 100644
--- a/swfdec/swfdec_text_field.h
+++ b/swfdec/swfdec_text_field.h
@@ -22,11 +22,11 @@
#define _SWFDEC_TEXT_FIELD_H_
#include <pango/pango.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_color.h>
-#include <libswfdec/swfdec_graphic.h>
-#include <libswfdec/swfdec_player.h>
-#include <libswfdec/swfdec_text_format.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_color.h>
+#include <swfdec/swfdec_graphic.h>
+#include <swfdec/swfdec_player.h>
+#include <swfdec/swfdec_text_format.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_text_field_movie.h b/swfdec/swfdec_text_field_movie.h
index 8d719d3..07d7a0e 100644
--- a/swfdec/swfdec_text_field_movie.h
+++ b/swfdec/swfdec_text_field_movie.h
@@ -21,10 +21,10 @@
#ifndef _SWFDEC_TEXT_FIELD_MOVIE_H_
#define _SWFDEC_TEXT_FIELD_MOVIE_H_
-#include <libswfdec/swfdec_movie.h>
-#include <libswfdec/swfdec_text_field.h>
-#include <libswfdec/swfdec_style_sheet.h>
-#include <libswfdec/swfdec_text_format.h>
+#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_text_field.h>
+#include <swfdec/swfdec_style_sheet.h>
+#include <swfdec/swfdec_text_format.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_text_format.h b/swfdec/swfdec_text_format.h
index 77dddb4..34e1e5e 100644
--- a/swfdec/swfdec_text_format.h
+++ b/swfdec/swfdec_text_format.h
@@ -21,10 +21,10 @@
#ifndef _SWFDEC_TEXT_FORMAT_H_
#define _SWFDEC_TEXT_FORMAT_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_array.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_script.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_as_array.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_script.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_video.h b/swfdec/swfdec_video.h
index 585c726..94569f7 100644
--- a/swfdec/swfdec_video.h
+++ b/swfdec/swfdec_video.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_VIDEO_H_
#define _SWFDEC_VIDEO_H_
-#include <libswfdec/swfdec_graphic.h>
-#include <libswfdec/swfdec_codec_video.h>
+#include <swfdec/swfdec_graphic.h>
+#include <swfdec/swfdec_codec_video.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_video_movie.h b/swfdec/swfdec_video_movie.h
index 958bc49..9d5af15 100644
--- a/swfdec/swfdec_video_movie.h
+++ b/swfdec/swfdec_video_movie.h
@@ -21,8 +21,8 @@
#define _SWFDEC_VIDEO_MOVIE_H_
#include <glib-object.h>
-#include <libswfdec/swfdec_movie.h>
-#include <libswfdec/swfdec_video.h>
+#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_video.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_xml.h b/swfdec/swfdec_xml.h
index 3be92d5..45c8ee8 100644
--- a/swfdec/swfdec_xml.h
+++ b/swfdec/swfdec_xml.h
@@ -21,10 +21,10 @@
#ifndef _SWFDEC_XML_H_
#define _SWFDEC_XML_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_script.h>
-#include <libswfdec/swfdec_xml_node.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_script.h>
+#include <swfdec/swfdec_xml_node.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_xml_node.h b/swfdec/swfdec_xml_node.h
index 7135613..49b5d48 100644
--- a/swfdec/swfdec_xml_node.h
+++ b/swfdec/swfdec_xml_node.h
@@ -21,10 +21,10 @@
#ifndef _SWFDEC_XML_NODE_H_
#define _SWFDEC_XML_NODE_H_
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/swfdec_script.h>
-#include <libswfdec/swfdec_player.h>
+#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_types.h>
+#include <swfdec/swfdec_script.h>
+#include <swfdec/swfdec_player.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_xml_socket.h b/swfdec/swfdec_xml_socket.h
index 95f19c2..eb751d5 100644
--- a/swfdec/swfdec_xml_socket.h
+++ b/swfdec/swfdec_xml_socket.h
@@ -20,8 +20,8 @@
#ifndef _SWFDEC_XML_SOCKET_H_
#define _SWFDEC_XML_SOCKET_H_
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_as_object.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_as_object.h>
G_BEGIN_DECLS
diff --git a/test/rtmp/rtmp_server.c b/test/rtmp/rtmp_server.c
index ec431e8..a5f6362 100644
--- a/test/rtmp/rtmp_server.c
+++ b/test/rtmp/rtmp_server.c
@@ -22,7 +22,7 @@
#endif
#include <libsoup/soup.h>
#include <libsoup/soup-address.h>
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
#include <glib/gprintf.h>
static void
diff --git a/test/sound/sound.c b/test/sound/sound.c
index 332ca12..ab8f566 100644
--- a/test/sound/sound.c
+++ b/test/sound/sound.c
@@ -21,7 +21,7 @@
#include "config.h"
#endif
#include <string.h>
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
/**
* audio_diff:
diff --git a/test/swfdec_test.c b/test/swfdec_test.c
index 957b35b..35e99d1 100644
--- a/test/swfdec_test.c
+++ b/test/swfdec_test.c
@@ -24,10 +24,10 @@
#include <stdlib.h>
#include <string.h>
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
/* FIXME: no internal headers please */
-#include <libswfdec/swfdec_as_array.h>
-#include <libswfdec/swfdec_as_internal.h>
+#include <swfdec/swfdec_as_array.h>
+#include <swfdec/swfdec_as_internal.h>
#include "swfdec_test_function.h"
#include "swfdec_test_initialize.h"
diff --git a/test/swfdec_test_function.h b/test/swfdec_test_function.h
index 08b6c27..a523fcd 100644
--- a/test/swfdec_test_function.h
+++ b/test/swfdec_test_function.h
@@ -17,7 +17,7 @@
* Boston, MA 02110-1301 USA
*/
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
#ifndef _SWFDEC_TEST_FUNCTION_H_
#define _SWFDEC_TEST_FUNCTION_H_
diff --git a/test/swfdec_test_global.c b/test/swfdec_test_global.c
index 6926944..7edd8d2 100644
--- a/test/swfdec_test_global.c
+++ b/test/swfdec_test_global.c
@@ -21,7 +21,7 @@
#include "config.h"
#endif
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
#include "swfdec_test_function.h"
#include "swfdec_test_initialize.h"
diff --git a/test/swfdec_test_image.h b/test/swfdec_test_image.h
index ef5bb2a..6de6ccc 100644
--- a/test/swfdec_test_image.h
+++ b/test/swfdec_test_image.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_TEST_IMAGE_H_
#define _SWFDEC_TEST_IMAGE_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/test/swfdec_test_test.h b/test/swfdec_test_test.h
index fe20221..aac940f 100644
--- a/test/swfdec_test_test.h
+++ b/test/swfdec_test_test.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_TEST_TEST_H_
#define _SWFDEC_TEST_TEST_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/test/various/gc.c b/test/various/gc.c
index cb21202..6f485b6 100644
--- a/test/various/gc.c
+++ b/test/various/gc.c
@@ -21,9 +21,9 @@
#include "config.h"
#endif
-#include "libswfdec/swfdec_as_context.h"
-#include "libswfdec/swfdec_as_object.h"
-#include "libswfdec/swfdec_as_strings.h"
+#include "swfdec/swfdec_as_context.h"
+#include "swfdec/swfdec_as_object.h"
+#include "swfdec/swfdec_as_strings.h"
#define ERROR(...) G_STMT_START { \
g_printerr ("ERROR (line %u): ", __LINE__); \
diff --git a/test/various/ringbuffer.c b/test/various/ringbuffer.c
index 3f2c4dc..5be9da7 100644
--- a/test/various/ringbuffer.c
+++ b/test/various/ringbuffer.c
@@ -21,7 +21,7 @@
#include "config.h"
#endif
-#include "libswfdec/swfdec_ringbuffer.h"
+#include "swfdec/swfdec_ringbuffer.h"
#define SIZE 5
diff --git a/tools/crashfinder.c b/tools/crashfinder.c
index 5840862..956a5a6 100644
--- a/tools/crashfinder.c
+++ b/tools/crashfinder.c
@@ -22,7 +22,7 @@
#include "config.h"
#endif
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
int
main (int argc, char **argv)
diff --git a/tools/dump.c b/tools/dump.c
index 0ab7d59..1b8d701 100644
--- a/tools/dump.c
+++ b/tools/dump.c
@@ -29,20 +29,20 @@
#include <sys/stat.h>
#include <glib.h>
#include <glib-object.h>
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_button.h>
-#include <libswfdec/swfdec_text_field.h>
-#include <libswfdec/swfdec_font.h>
-#include <libswfdec/swfdec_image.h>
-#include <libswfdec/swfdec_movie.h>
-#include <libswfdec/swfdec_player_internal.h>
-#include <libswfdec/swfdec_sprite.h>
-#include <libswfdec/swfdec_shape.h>
-#include <libswfdec/swfdec_sound.h>
-#include <libswfdec/swfdec_swf_decoder.h>
-#include <libswfdec/swfdec_resource.h>
-#include <libswfdec/swfdec_tag.h>
-#include <libswfdec/swfdec_text.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_button.h>
+#include <swfdec/swfdec_text_field.h>
+#include <swfdec/swfdec_font.h>
+#include <swfdec/swfdec_image.h>
+#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_player_internal.h>
+#include <swfdec/swfdec_sprite.h>
+#include <swfdec/swfdec_shape.h>
+#include <swfdec/swfdec_sound.h>
+#include <swfdec/swfdec_swf_decoder.h>
+#include <swfdec/swfdec_resource.h>
+#include <swfdec/swfdec_tag.h>
+#include <swfdec/swfdec_text.h>
static gboolean verbose = FALSE;
diff --git a/tools/swfdec-extract.c b/tools/swfdec-extract.c
index 2c72f3b..b233818 100644
--- a/tools/swfdec-extract.c
+++ b/tools/swfdec-extract.c
@@ -31,17 +31,17 @@
#ifdef CAIRO_HAS_PDF_SURFACE
# include <cairo-pdf.h>
#endif
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_audio_stream.h>
-#include <libswfdec/swfdec_button.h>
-#include <libswfdec/swfdec_graphic.h>
-#include <libswfdec/swfdec_image.h>
-#include <libswfdec/swfdec_player_internal.h>
-#include <libswfdec/swfdec_sound.h>
-#include <libswfdec/swfdec_sprite.h>
-#include <libswfdec/swfdec_sprite_movie.h>
-#include <libswfdec/swfdec_swf_decoder.h>
-#include <libswfdec/swfdec_resource.h>
+#include <swfdec/swfdec.h>
+#include <swfdec/swfdec_audio_stream.h>
+#include <swfdec/swfdec_button.h>
+#include <swfdec/swfdec_graphic.h>
+#include <swfdec/swfdec_image.h>
+#include <swfdec/swfdec_player_internal.h>
+#include <swfdec/swfdec_sound.h>
+#include <swfdec/swfdec_sprite.h>
+#include <swfdec/swfdec_sprite_movie.h>
+#include <swfdec/swfdec_swf_decoder.h>
+#include <swfdec/swfdec_resource.h>
static SwfdecBuffer *
encode_wav (SwfdecBuffer *buffer, SwfdecAudioFormat format)
diff --git a/tools/swfdec_out.h b/tools/swfdec_out.h
index e343f9d..2544f33 100644
--- a/tools/swfdec_out.h
+++ b/tools/swfdec_out.h
@@ -20,9 +20,9 @@
#ifndef __SWFDEC_OUT_H__
#define __SWFDEC_OUT_H__
-#include <libswfdec/swfdec_buffer.h>
-#include <libswfdec/swfdec_color.h>
-#include <libswfdec/swfdec_rect.h>
+#include <swfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_color.h>
+#include <swfdec/swfdec_rect.h>
G_BEGIN_DECLS
diff --git a/tools/swfedit_file.c b/tools/swfedit_file.c
index e257010..22684a3 100644
--- a/tools/swfedit_file.c
+++ b/tools/swfedit_file.c
@@ -23,10 +23,10 @@
#include <zlib.h>
-#include "libswfdec/swfdec_bits.h"
-#include "libswfdec/swfdec_buffer.h"
-#include "libswfdec/swfdec_debug.h"
-#include "libswfdec/swfdec_swf_decoder.h"
+#include "swfdec/swfdec_bits.h"
+#include "swfdec/swfdec_buffer.h"
+#include "swfdec/swfdec_debug.h"
+#include "swfdec/swfdec_swf_decoder.h"
#include "swfdec_out.h"
#include "swfedit_file.h"
#include "swfedit_tag.h"
diff --git a/tools/swfedit_file.h b/tools/swfedit_file.h
index ecd096a..212c7b7 100644
--- a/tools/swfedit_file.h
+++ b/tools/swfedit_file.h
@@ -20,7 +20,7 @@
#ifndef __SWFEDIT_FILE_H__
#define __SWFEDIT_FILE_H__
-#include <libswfdec/swfdec_rect.h>
+#include <swfdec/swfdec_rect.h>
#include "swfedit_token.h"
G_BEGIN_DECLS
diff --git a/tools/swfedit_tag.c b/tools/swfedit_tag.c
index 4a4bf67..868632c 100644
--- a/tools/swfedit_tag.c
+++ b/tools/swfedit_tag.c
@@ -24,10 +24,10 @@
#include <stdlib.h>
#include <gtk/gtk.h>
-#include <libswfdec/swfdec_bits.h>
-#include <libswfdec/swfdec_debug.h>
-#include <libswfdec/swfdec_script_internal.h>
-#include <libswfdec/swfdec_tag.h>
+#include <swfdec/swfdec_bits.h>
+#include <swfdec/swfdec_debug.h>
+#include <swfdec/swfdec_script_internal.h>
+#include <swfdec/swfdec_tag.h>
#include "swfedit_tag.h"
#include "swfdec_out.h"
#include "swfedit_file.h"
diff --git a/tools/swfedit_tag.h b/tools/swfedit_tag.h
index 2f1d231..b148f24 100644
--- a/tools/swfedit_tag.h
+++ b/tools/swfedit_tag.h
@@ -20,8 +20,8 @@
#ifndef __SWFEDIT_TAG_H__
#define __SWFEDIT_TAG_H__
-#include <libswfdec/swfdec_buffer.h>
-#include <libswfdec/swfdec_bits.h>
+#include <swfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_bits.h>
#include "swfdec_out.h"
#include "swfedit_token.h"
diff --git a/tools/swfedit_token.c b/tools/swfedit_token.c
index 34496df..11bedfc 100644
--- a/tools/swfedit_token.c
+++ b/tools/swfedit_token.c
@@ -24,9 +24,9 @@
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
-#include <libswfdec/swfdec_buffer.h>
-#include <libswfdec/swfdec_color.h>
-#include <libswfdec/swfdec_script_internal.h>
+#include <swfdec/swfdec_buffer.h>
+#include <swfdec/swfdec_color.h>
+#include <swfdec/swfdec_script_internal.h>
#include "swfedit_token.h"
/*** CONVERTERS ***/
diff --git a/tools/swfedit_token.h b/tools/swfedit_token.h
index 448f4cb..c46e0ef 100644
--- a/tools/swfedit_token.h
+++ b/tools/swfedit_token.h
@@ -21,7 +21,7 @@
#define __SWFEDIT_TOKEN_H__
#include <gtk/gtk.h>
-#include <libswfdec/swfdec_rect.h>
+#include <swfdec/swfdec_rect.h>
G_BEGIN_DECLS
diff --git a/tools/swfscript.c b/tools/swfscript.c
index 4e2a9e4..71435f4 100644
--- a/tools/swfscript.c
+++ b/tools/swfscript.c
@@ -22,7 +22,7 @@
#endif
#include <gtk/gtk.h>
-#include "libswfdec/swfdec_script_internal.h"
+#include "swfdec/swfdec_script_internal.h"
#include "swfdec_out.h"
#include "swfedit_file.h"
diff --git a/vivified/core/vivi_application.c b/vivified/core/vivi_application.c
index ab41662..623e293 100644
--- a/vivified/core/vivi_application.c
+++ b/vivified/core/vivi_application.c
@@ -21,7 +21,7 @@
#include "config.h"
#endif
-#include <libswfdec-gtk/swfdec-gtk.h>
+#include <swfdec-gtk/swfdec-gtk.h>
#include "vivi_application.h"
#include "vivi_debugger.h"
#include "vivi_function.h"
diff --git a/vivified/core/vivi_application.h b/vivified/core/vivi_application.h
index d5d0c2b..0ebe0fd 100644
--- a/vivified/core/vivi_application.h
+++ b/vivified/core/vivi_application.h
@@ -20,7 +20,7 @@
#ifndef _VIVI_APPLICATION_H_
#define _VIVI_APPLICATION_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
G_BEGIN_DECLS
diff --git a/vivified/core/vivi_breakpoint.h b/vivified/core/vivi_breakpoint.h
index 35a8d28..ed9af66 100644
--- a/vivified/core/vivi_breakpoint.h
+++ b/vivified/core/vivi_breakpoint.h
@@ -20,7 +20,7 @@
#ifndef _VIVI_BREAKPOINT_H_
#define _VIVI_BREAKPOINT_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
#include <vivified/core/vivi_application.h>
G_BEGIN_DECLS
diff --git a/vivified/core/vivi_debugger.c b/vivified/core/vivi_debugger.c
index b65392f..98f4466 100644
--- a/vivified/core/vivi_debugger.c
+++ b/vivified/core/vivi_debugger.c
@@ -25,7 +25,7 @@
#include "vivi_application.h"
#include "vivi_marshal.h"
/* FIXME: oops */
-#include "libswfdec/swfdec_player_internal.h"
+#include "swfdec/swfdec_player_internal.h"
enum {
ADD,
diff --git a/vivified/core/vivi_debugger.h b/vivified/core/vivi_debugger.h
index 76873ab..80a6765 100644
--- a/vivified/core/vivi_debugger.h
+++ b/vivified/core/vivi_debugger.h
@@ -20,7 +20,7 @@
#ifndef _VIVI_DEBUGGER_H_
#define _VIVI_DEBUGGER_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
#include <vivified/core/vivi_application.h>
G_BEGIN_DECLS
diff --git a/vivified/core/vivi_function.h b/vivified/core/vivi_function.h
index 2642579..f1d497c 100644
--- a/vivified/core/vivi_function.h
+++ b/vivified/core/vivi_function.h
@@ -17,7 +17,7 @@
* Boston, MA 02110-1301 USA
*/
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
#include <vivified/core/vivi_application.h>
#ifndef _VIVI_FUNCTION_H_
diff --git a/vivified/core/vivi_ming.h b/vivified/core/vivi_ming.h
index 98d3b85..f33eb5a 100644
--- a/vivified/core/vivi_ming.h
+++ b/vivified/core/vivi_ming.h
@@ -17,7 +17,7 @@
* Boston, MA 02110-1301 USA
*/
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
#include <ming.h>
#ifndef _VIVI_MING_H_
diff --git a/vivified/core/vivi_player_as.c b/vivified/core/vivi_player_as.c
index 4552cd4..f2d79e8 100644
--- a/vivified/core/vivi_player_as.c
+++ b/vivified/core/vivi_player_as.c
@@ -24,7 +24,7 @@
#include "vivi_wrap.h"
#include "vivi_application.h"
#include "vivi_function.h"
-#include <libswfdec-gtk/swfdec-gtk.h>
+#include <swfdec-gtk/swfdec-gtk.h>
VIVI_FUNCTION ("player_frame_get", vivi_player_as_frame_get)
void
diff --git a/vivified/core/vivi_wrap.h b/vivified/core/vivi_wrap.h
index 2c551e0..9f0aec0 100644
--- a/vivified/core/vivi_wrap.h
+++ b/vivified/core/vivi_wrap.h
@@ -20,7 +20,7 @@
#ifndef _VIVI_WRAP_H_
#define _VIVI_WRAP_H_
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
#include <vivified/core/vivi_application.h>
G_BEGIN_DECLS
diff --git a/vivified/ui/main.c b/vivified/ui/main.c
index 3462be6..38568ec 100644
--- a/vivified/ui/main.c
+++ b/vivified/ui/main.c
@@ -22,7 +22,7 @@
#endif
#include <gtk/gtk.h>
-#include <libswfdec-gtk/swfdec-gtk.h>
+#include <swfdec-gtk/swfdec-gtk.h>
#include "vivified/core/vivified-core.h"
#include "vivified/dock/vivified-dock.h"
#include "vivi_window.h"
diff --git a/vivified/ui/vivi_movie_list.c b/vivified/ui/vivi_movie_list.c
index 35aa0dd..61a471f 100644
--- a/vivified/ui/vivi_movie_list.c
+++ b/vivified/ui/vivi_movie_list.c
@@ -22,8 +22,8 @@
#endif
#include <gtk/gtk.h>
-#include <libswfdec/swfdec_movie.h>
-#include <libswfdec/swfdec_player_internal.h>
+#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_player_internal.h>
#include "vivi_movie_list.h"
/*** GTK_TREE_MODEL ***/
diff --git a/vivified/ui/vivi_movies.c b/vivified/ui/vivi_movies.c
index a4c8e37..cc88466 100644
--- a/vivified/ui/vivi_movies.c
+++ b/vivified/ui/vivi_movies.c
@@ -21,7 +21,7 @@
#include "config.h"
#endif
-#include <libswfdec-gtk/swfdec-gtk.h>
+#include <swfdec-gtk/swfdec-gtk.h>
#include "vivi_vivi_docklet.h"
#include "vivi_movie_list.h"
diff --git a/vivified/ui/vivi_player.c b/vivified/ui/vivi_player.c
index e8134b2..f456e07 100644
--- a/vivified/ui/vivi_player.c
+++ b/vivified/ui/vivi_player.c
@@ -21,7 +21,7 @@
#include "config.h"
#endif
-#include <libswfdec-gtk/swfdec-gtk.h>
+#include <swfdec-gtk/swfdec-gtk.h>
#include "vivi_vivi_docklet.h"
#include "vivi_widget.h"
diff --git a/vivified/ui/vivi_widget.h b/vivified/ui/vivi_widget.h
index b861ed1..f7d4727 100644
--- a/vivified/ui/vivi_widget.h
+++ b/vivified/ui/vivi_widget.h
@@ -20,7 +20,7 @@
#ifndef _VIVI_WIDGET_H_
#define _VIVI_WIDGET_H_
-#include <libswfdec-gtk/swfdec-gtk.h>
+#include <swfdec-gtk/swfdec-gtk.h>
#include <vivified/core/vivified-core.h>
G_BEGIN_DECLS
diff --git a/vivified/ui/vivi_window.h b/vivified/ui/vivi_window.h
index 80c0b27..7edcd5a 100644
--- a/vivified/ui/vivi_window.h
+++ b/vivified/ui/vivi_window.h
@@ -23,7 +23,7 @@
#include <vivified/dock/vivified-dock.h>
#include <vivified/core/vivified-core.h>
/* FIXME */
-#include <libswfdec/swfdec_movie.h>
+#include <swfdec/swfdec_movie.h>
G_BEGIN_DECLS
commit 8bd46798336662f4167d967791aac394ed1881c6
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Jan 24 13:09:46 2008 +0100
rename "libswfdec" to "swfdec" and "libswfdec-gtk" to "swfdec-gtk"
diff --git a/libswfdec-gtk/.gitignore b/libswfdec-gtk/.gitignore
deleted file mode 100644
index cad6c66..0000000
--- a/libswfdec-gtk/.gitignore
+++ /dev/null
@@ -1,14 +0,0 @@
-*~
-CVS
-.cvsignore
-.deps
-.libs
-
-Makefile
-Makefile.in
-*.o
-*.la
-*.lo
-*.loT
-
-swfdec_playback.c
diff --git a/libswfdec-gtk/Makefile.am b/libswfdec-gtk/Makefile.am
deleted file mode 100644
index 4f724cf..0000000
--- a/libswfdec-gtk/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# this workaround is needed or autotools don't generate the .deps/*.Plo files correctly
-swfdec_playback.c: swfdec_playback_$(AUDIO_TYPE).c Makefile
- cmp -s $(srcdir)/swfdec_playback_$(AUDIO_TYPE).c swfdec_playback.c \
- || cp $(srcdir)/swfdec_playback_$(AUDIO_TYPE).c swfdec_playback.c
-
-BUILT_SOURCES = swfdec_playback.c
-CLEANFILES = swfdec_playback.c
-
-lib_LTLIBRARIES = libswfdec-gtk- at SWFDEC_MAJORMINOR@.la
-
-libswfdec_gtk_ at SWFDEC_MAJORMINOR@_la_SOURCES = \
- swfdec_playback.c \
- swfdec_source.c \
- swfdec_gtk_keys.c \
- swfdec_gtk_loader.c \
- swfdec_gtk_player.c \
- swfdec_gtk_socket.c \
- swfdec_gtk_widget.c
-
-noinst_HEADERS = \
- swfdec_playback.h \
- swfdec_source.h
-
-libswfdec_gtk_ at SWFDEC_MAJORMINOR@_la_CFLAGS = \
- -I$(top_srcdir) $(GLOBAL_CFLAGS) $(SWFDEC_CFLAGS) $(GTK_CFLAGS) \
- $(AUDIO_CFLAGS) \
- -DG_LOG_DOMAIN=\"Swfdec-Gtk\"
-libswfdec_gtk_ at SWFDEC_MAJORMINOR@_la_LDFLAGS = \
- -version-info $(SWFDEC_LIBVERSION) \
- -export-symbols-regex '^(swfdec_.*)' \
- $(GTK_LIBS) $(SWFDEC_LIBS) $(AUDIO_LIBS)
-libswfdec_ at SWFDEC_MAJORMINOR@includedir = $(includedir)/swfdec- at SWFDEC_MAJORMINOR@/libswfdec-gtk
-libswfdec_ at SWFDEC_MAJORMINOR@include_HEADERS = \
- swfdec-gtk.h \
- swfdec_gtk_keys.h \
- swfdec_gtk_loader.h \
- swfdec_gtk_player.h \
- swfdec_gtk_socket.h \
- swfdec_gtk_widget.h
-
-EXTRA_DIST = \
- swfdec_playback_alsa.c \
- swfdec_playback_oss.c \
- swfdec_playback_pa.c \
- swfdec_playback_none.c
diff --git a/libswfdec-gtk/swfdec-gtk.h b/libswfdec-gtk/swfdec-gtk.h
deleted file mode 100644
index b64cf83..0000000
--- a/libswfdec-gtk/swfdec-gtk.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef __SWFDEC_GTK_H__
-#define __SWFDEC_GTK_H__
-
-#include <libswfdec-gtk/swfdec_gtk_keys.h>
-#include <libswfdec-gtk/swfdec_gtk_loader.h>
-#include <libswfdec-gtk/swfdec_gtk_player.h>
-#include <libswfdec-gtk/swfdec_gtk_socket.h>
-#include <libswfdec-gtk/swfdec_gtk_widget.h>
-
-#endif
diff --git a/libswfdec-gtk/swfdec_gtk_keys.c b/libswfdec-gtk/swfdec_gtk_keys.c
deleted file mode 100644
index 69e0a6e..0000000
--- a/libswfdec-gtk/swfdec_gtk_keys.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "swfdec_gtk_keys.h"
-
-static const guint8 flash_keycodes[] = {
- /* 0 */ 0, 0, 0, 0, 0,
- /* 5 */ 0, 0, 0, 0, SWFDEC_KEY_ESCAPE,
- /* 10 */ SWFDEC_KEY_1, SWFDEC_KEY_2, SWFDEC_KEY_3, SWFDEC_KEY_4, SWFDEC_KEY_5,
- /* 15 */ SWFDEC_KEY_6, SWFDEC_KEY_7, SWFDEC_KEY_8, SWFDEC_KEY_9, SWFDEC_KEY_0,
- /* 20 */ SWFDEC_KEY_MINUS, SWFDEC_KEY_EQUAL, SWFDEC_KEY_BACKSPACE, SWFDEC_KEY_TAB, SWFDEC_KEY_Q,
- /* 25 */ SWFDEC_KEY_W, SWFDEC_KEY_E, SWFDEC_KEY_R, SWFDEC_KEY_T, SWFDEC_KEY_Y,
- /* 30 */ SWFDEC_KEY_U, SWFDEC_KEY_I, SWFDEC_KEY_O, SWFDEC_KEY_P, SWFDEC_KEY_LEFT_BRACKET,
- /* 35 */ SWFDEC_KEY_RIGHT_BRACKET, SWFDEC_KEY_ENTER, SWFDEC_KEY_CONTROL, SWFDEC_KEY_A, SWFDEC_KEY_S,
- /* 40 */ SWFDEC_KEY_D, SWFDEC_KEY_F, SWFDEC_KEY_G, SWFDEC_KEY_H, SWFDEC_KEY_J,
- /* 45 */ SWFDEC_KEY_K, SWFDEC_KEY_L, SWFDEC_KEY_SEMICOLON, SWFDEC_KEY_APOSTROPHE, SWFDEC_KEY_GRAVE,
- /* 50 */ SWFDEC_KEY_SHIFT, SWFDEC_KEY_BACKSLASH, SWFDEC_KEY_Z, SWFDEC_KEY_X, SWFDEC_KEY_C,
- /* 55 */ SWFDEC_KEY_V, SWFDEC_KEY_B, SWFDEC_KEY_N, SWFDEC_KEY_M, 0,
- /* 60 */ 0, SWFDEC_KEY_SLASH, SWFDEC_KEY_SHIFT, SWFDEC_KEY_NUMPAD_MULTIPLY, SWFDEC_KEY_ALT,
- /* 65 */ SWFDEC_KEY_SPACE, 0, SWFDEC_KEY_F1, SWFDEC_KEY_F2, SWFDEC_KEY_F3,
- /* 70 */ SWFDEC_KEY_F4, SWFDEC_KEY_F5, SWFDEC_KEY_F6, SWFDEC_KEY_F7, SWFDEC_KEY_F8,
- /* 75 */ SWFDEC_KEY_F9, SWFDEC_KEY_F10, SWFDEC_KEY_NUM_LOCK, 0, SWFDEC_KEY_NUMPAD_7,
- /* 80 */ SWFDEC_KEY_NUMPAD_8, SWFDEC_KEY_NUMPAD_9, SWFDEC_KEY_NUMPAD_SUBTRACT, SWFDEC_KEY_NUMPAD_4, SWFDEC_KEY_NUMPAD_5,
- /* 85 */ SWFDEC_KEY_NUMPAD_6, SWFDEC_KEY_NUMPAD_ADD, SWFDEC_KEY_NUMPAD_1, SWFDEC_KEY_NUMPAD_2, SWFDEC_KEY_NUMPAD_3,
- /* 90 */ SWFDEC_KEY_NUMPAD_0, SWFDEC_KEY_NUMPAD_DECIMAL, 0, 0, 0,
- /* 95 */ SWFDEC_KEY_F11, SWFDEC_KEY_F12, SWFDEC_KEY_HOME, SWFDEC_KEY_UP, SWFDEC_KEY_PAGE_UP,
- /* 100 */ SWFDEC_KEY_LEFT, 0, SWFDEC_KEY_RIGHT, SWFDEC_KEY_END, SWFDEC_KEY_DOWN,
- /* 105 */ SWFDEC_KEY_PAGE_DOWN, SWFDEC_KEY_INSERT, SWFDEC_KEY_DELETE, SWFDEC_KEY_ENTER, SWFDEC_KEY_CONTROL,
- /* 110 */ 0, 0, SWFDEC_KEY_NUMPAD_DIVIDE, SWFDEC_KEY_ALT, 0,
- /* 115 */ 0, 0, 0, 0, 0
-};
-/*
-SWFDEC_KEY_COMMA 59
-SWFDEC_KEY_DOT 60
-SWFDEC_KEY_SCROLL_LOCK 78
-SWFDEC_KEY_BREAK 110
-SWFDEC_KEY_META 115
-SWFDEC_KEY_META_R 116
-SWFDEC_KEY_MENU 117
-*/
-
-/**
- * swfdec_gtk_keycode_from_hardware_keycode:
- * @hardware_keycode: a hardware keycode sent from the X server
- *
- * Tries to transform an X hardware keycode to the corresponding #SwfdecKey.
- * This is a utility function for cases where key events need to be transformed
- * manually.
- *
- * Returns: the corresponding key code as used in Flash.
- **/
-guint
-swfdec_gtk_keycode_from_hardware_keycode (guint hardware_keycode)
-{
- if (hardware_keycode >= G_N_ELEMENTS (flash_keycodes))
- return 0;
- return flash_keycodes[hardware_keycode];
-}
diff --git a/libswfdec-gtk/swfdec_gtk_keys.h b/libswfdec-gtk/swfdec_gtk_keys.h
deleted file mode 100644
index d9b985b..0000000
--- a/libswfdec-gtk/swfdec_gtk_keys.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_GTK_KEYS_H_
-#define _SWFDEC_GTK_KEYS_H_
-
-#include <libswfdec/swfdec.h>
-
-G_BEGIN_DECLS
-
-guint swfdec_gtk_keycode_from_hardware_keycode (guint hardware_keycode);
-
-G_END_DECLS
-#endif
diff --git a/libswfdec-gtk/swfdec_gtk_loader.c b/libswfdec-gtk/swfdec_gtk_loader.c
deleted file mode 100644
index 375ca60..0000000
--- a/libswfdec-gtk/swfdec_gtk_loader.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <libsoup/soup.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include "swfdec_gtk_loader.h"
-
-/*** GTK-DOC ***/
-
-/**
- * SECTION:SwfdecGtkLoader
- * @title: SwfdecGtkLoader
- * @short_description: advanced loader able to load network ressources
- * @see_also: #SwfdecLoader
- *
- * #SwfdecGtkLoader is a #SwfdecLoader that is intended as an easy way to be
- * access ressources that are not stored in files, such as HTTP. It can
- * however be compiled with varying support for different protocols, so don't
- * rely on support for a particular protocol being available. If you need this,
- * code your own SwfdecLoader subclass.
- */
-
-/**
- * SwfdecGtkLoader:
- *
- * This is the object used to represent a loader. Since it may use varying
- * backends, it is completely private.
- */
-
-struct _SwfdecGtkLoader
-{
- SwfdecLoader loader;
-
- SoupMessage * message; /* the message we're sending */
- gboolean opened; /* set after first bytes of data have arrived */
-};
-
-struct _SwfdecGtkLoaderClass {
- SwfdecLoaderClass loader_class;
-
- SoupSession * session; /* the session used by the loader */
-};
-
-/*** SwfdecGtkLoader ***/
-
-G_DEFINE_TYPE (SwfdecGtkLoader, swfdec_gtk_loader, SWFDEC_TYPE_FILE_LOADER)
-
-static void
-swfdec_gtk_loader_set_size (SwfdecGtkLoader *gtk)
-{
- const char *s = soup_message_get_header (gtk->message->response_headers, "Content-Length");
- unsigned long l;
- char *end;
-
- if (s == NULL)
- return;
-
- errno = 0;
- l = strtoul (s, &end, 10);
- if (errno == 0 && *end == 0 && l <= G_MAXLONG)
- swfdec_loader_set_size (SWFDEC_LOADER (gtk), l);
-}
-
-static void
-swfdec_gtk_loader_ensure_open (SwfdecGtkLoader *gtk)
-{
- char *real_uri;
-
- if (gtk->opened)
- return;
-
- real_uri = soup_uri_to_string (soup_message_get_uri (gtk->message), FALSE);
- swfdec_gtk_loader_set_size (gtk);
- swfdec_loader_set_url (SWFDEC_LOADER (gtk), real_uri);
- swfdec_stream_open (SWFDEC_STREAM (gtk));
- gtk->opened = TRUE;
- g_free (real_uri);
-}
-
-static void
-swfdec_gtk_loader_push (SoupMessage *msg, gpointer loader)
-{
- SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (loader);
- SwfdecBuffer *buffer;
-
- swfdec_gtk_loader_ensure_open (gtk);
- buffer = swfdec_buffer_new_and_alloc (msg->response.length);
- memcpy (buffer->data, msg->response.body, msg->response.length);
- swfdec_stream_push (loader, buffer);
-}
-
-static void
-swfdec_gtk_loader_finished (SoupMessage *msg, gpointer loader)
-{
- if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
- swfdec_gtk_loader_ensure_open (loader);
- swfdec_stream_eof (loader);
- } else {
- swfdec_stream_error (loader, "%u %s", msg->status_code, msg->reason_phrase);
- }
-}
-
-static void
-swfdec_gtk_loader_dispose (GObject *object)
-{
- SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (object);
-
- if (gtk->message) {
- g_signal_handlers_disconnect_by_func (gtk->message, swfdec_gtk_loader_push, gtk);
- g_signal_handlers_disconnect_by_func (gtk->message, swfdec_gtk_loader_finished, gtk);
- g_object_unref (gtk->message);
- gtk->message = NULL;
- }
-
- G_OBJECT_CLASS (swfdec_gtk_loader_parent_class)->dispose (object);
-}
-
-static void
-swfdec_gtk_loader_load (SwfdecLoader *loader, SwfdecPlayer *player,
- const char *url_string, SwfdecLoaderRequest request, SwfdecBuffer *buffer)
-{
- SwfdecURL *url;
-
- if (swfdec_url_path_is_relative (url_string)) {
- url = swfdec_url_new_relative (swfdec_player_get_base_url (player), url_string);
- } else {
- url = swfdec_url_new (url_string);
- }
-
- if (url == NULL) {
- swfdec_stream_error (SWFDEC_STREAM (loader), "invalid URL %s", url_string);
- return;
- };
- if (!swfdec_url_has_protocol (url, "http") &&
- !swfdec_url_has_protocol (url, "https")) {
- SWFDEC_LOADER_CLASS (swfdec_gtk_loader_parent_class)->load (loader, player,
- url_string, request, buffer);
- } else {
- SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (loader);
- SwfdecGtkLoaderClass *klass = SWFDEC_GTK_LOADER_GET_CLASS (gtk);
-
- gtk->message = soup_message_new (request == SWFDEC_LOADER_REQUEST_POST ? "POST" : "GET",
- swfdec_url_get_url (url));
- soup_message_set_flags (gtk->message, SOUP_MESSAGE_OVERWRITE_CHUNKS);
- g_signal_connect (gtk->message, "got-chunk", G_CALLBACK (swfdec_gtk_loader_push), gtk);
- g_signal_connect (gtk->message, "finished", G_CALLBACK (swfdec_gtk_loader_finished), gtk);
- if (buffer)
- soup_message_set_request (gtk->message, "appliation/x-www-urlencoded",
- SOUP_BUFFER_USER_OWNED, (char *) buffer->data, buffer->length);
- g_object_ref (gtk->message);
- soup_session_queue_message (klass->session, gtk->message, NULL, NULL);
- }
- swfdec_url_free (url);
-}
-
-static void
-swfdec_gtk_loader_close (SwfdecStream *stream)
-{
- SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (stream);
-
- if (gtk->message) {
- gboolean eof;
-
- g_object_get (stream, "eof", &eof, NULL);
- if (!eof) {
- SwfdecGtkLoaderClass *klass = SWFDEC_GTK_LOADER_GET_CLASS (gtk);
-
- soup_session_cancel_message (klass->session, gtk->message);
- g_object_unref (gtk->message);
- gtk->message = NULL;
- }
- }
-}
-
-static void
-swfdec_gtk_loader_class_init (SwfdecGtkLoaderClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- SwfdecStreamClass *stream_class = SWFDEC_STREAM_CLASS (klass);
- SwfdecLoaderClass *loader_class = SWFDEC_LOADER_CLASS (klass);
-
- object_class->dispose = swfdec_gtk_loader_dispose;
-
- stream_class->close = swfdec_gtk_loader_close;
-
- loader_class->load = swfdec_gtk_loader_load;
-
- klass->session = soup_session_async_new ();
-}
-
-static void
-swfdec_gtk_loader_init (SwfdecGtkLoader *gtk_loader)
-{
-}
-
diff --git a/libswfdec-gtk/swfdec_gtk_loader.h b/libswfdec-gtk/swfdec_gtk_loader.h
deleted file mode 100644
index ccae174..0000000
--- a/libswfdec-gtk/swfdec_gtk_loader.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_GTK_LOADER_H_
-#define _SWFDEC_GTK_LOADER_H_
-
-#include <libswfdec/swfdec.h>
-
-G_BEGIN_DECLS
-
-
-typedef struct _SwfdecGtkLoader SwfdecGtkLoader;
-typedef struct _SwfdecGtkLoaderClass SwfdecGtkLoaderClass;
-
-#define SWFDEC_TYPE_GTK_LOADER (swfdec_gtk_loader_get_type())
-#define SWFDEC_IS_GTK_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_GTK_LOADER))
-#define SWFDEC_IS_GTK_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_GTK_LOADER))
-#define SWFDEC_GTK_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_GTK_LOADER, SwfdecGtkLoader))
-#define SWFDEC_GTK_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_GTK_LOADER, SwfdecGtkLoaderClass))
-#define SWFDEC_GTK_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_GTK_LOADER, SwfdecGtkLoaderClass))
-
-GType swfdec_gtk_loader_get_type (void);
-
-
-G_END_DECLS
-#endif
diff --git a/libswfdec-gtk/swfdec_gtk_player.c b/libswfdec-gtk/swfdec_gtk_player.c
deleted file mode 100644
index 6d0a0a3..0000000
--- a/libswfdec-gtk/swfdec_gtk_player.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "libswfdec-gtk/swfdec_gtk_loader.h"
-#include "libswfdec-gtk/swfdec_gtk_player.h"
-#include "libswfdec-gtk/swfdec_gtk_socket.h"
-#include "libswfdec-gtk/swfdec_playback.h"
-#include "libswfdec-gtk/swfdec_source.h"
-
-struct _SwfdecGtkPlayer
-{
- SwfdecPlayer player;
-
- GSource * source; /* source if playing, NULL otherwise */
- SwfdecPlayback * playback; /* audio playback object */
- gboolean audio_enabled; /* TRUE if audio should be played */
- double speed; /* desired playback speed */
-};
-
-struct _SwfdecGtkPlayerClass
-{
- SwfdecPlayerClass player_class;
-};
-
-enum {
- PROP_0,
- PROP_PLAYING,
- PROP_AUDIO,
- PROP_SPEED
-};
-
-/*** gtk-doc ***/
-
-/**
- * SECTION:SwfdecGtkPlayer
- * @title: SwfdecGtkPlayer
- * @short_description: an improved #SwfdecPlayer
- *
- * The #SwfdecGtkPlayer adds common functionality to the rather barebones
- * #SwfdecPlayer class, such as automatic playback and audio handling. Note
- * that by default, the player will be paused, so you need to call
- * swfdec_gtk_player_set_playing () on the new player.
- *
- * @see_also: SwfdecPlayer
- */
-
-/**
- * SwfdecGtkPlayer:
- *
- * The structure for the Swfdec Gtk player contains no public fields.
- */
-
-/*** SWFDEC_GTK_PLAYER ***/
-
-G_DEFINE_TYPE (SwfdecGtkPlayer, swfdec_gtk_player, SWFDEC_TYPE_PLAYER)
-
-static void
-swfdec_gtk_player_get_property (GObject *object, guint param_id, GValue *value,
- GParamSpec * pspec)
-{
- SwfdecGtkPlayer *player = SWFDEC_GTK_PLAYER (object);
-
- switch (param_id) {
- case PROP_PLAYING:
- g_value_set_boolean (value, player->source != NULL);
- break;
- case PROP_AUDIO:
- g_value_set_boolean (value, player->audio_enabled);
- break;
- case PROP_SPEED:
- g_value_set_double (value, player->speed);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-swfdec_gtk_player_set_property (GObject *object, guint param_id, const GValue *value,
- GParamSpec *pspec)
-{
- SwfdecGtkPlayer *player = SWFDEC_GTK_PLAYER (object);
-
- switch (param_id) {
- case PROP_PLAYING:
- swfdec_gtk_player_set_playing (player, g_value_get_boolean (value));
- break;
- case PROP_AUDIO:
- swfdec_gtk_player_set_audio_enabled (player, g_value_get_boolean (value));
- break;
- case PROP_SPEED:
- swfdec_gtk_player_set_speed (player, g_value_get_double (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-swfdec_gtk_player_dispose (GObject *object)
-{
- SwfdecGtkPlayer *player = SWFDEC_GTK_PLAYER (object);
-
- swfdec_gtk_player_set_playing (player, FALSE);
- g_assert (player->playback == NULL);
-
- G_OBJECT_CLASS (swfdec_gtk_player_parent_class)->dispose (object);
-}
-
-static void
-swfdec_gtk_player_class_init (SwfdecGtkPlayerClass * g_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (g_class);
-
- object_class->dispose = swfdec_gtk_player_dispose;
- object_class->get_property = swfdec_gtk_player_get_property;
- object_class->set_property = swfdec_gtk_player_set_property;
-
- g_object_class_install_property (object_class, PROP_PLAYING,
- g_param_spec_boolean ("playing", "playing", "TRUE if the player is playing (d'oh)",
- FALSE, G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_AUDIO,
- g_param_spec_boolean ("audio-enabled", "audio enabled", "TRUE if automatic audio handling is enabled",
- TRUE, G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_SPEED,
- g_param_spec_double ("speed", "speed", "desired playback speed",
- G_MINDOUBLE, G_MAXDOUBLE, 1.0, G_PARAM_READWRITE));
-}
-
-static void
-swfdec_gtk_player_init (SwfdecGtkPlayer * player)
-{
- player->speed = 1.0;
- player->audio_enabled = TRUE;
-}
-
-/*** PUBLIC API ***/
-
-/**
- * swfdec_gtk_player_new:
- * @debugger: %NULL or a #SwfdecAsDebugger to debug this player
- *
- * Creates a new Swfdec Gtk player.
- * This function calls swfdec_init () for you if it wasn't called before.
- *
- * Returns: The new player
- **/
-SwfdecPlayer *
-swfdec_gtk_player_new (SwfdecAsDebugger *debugger)
-{
- SwfdecPlayer *player;
-
- swfdec_init ();
- player = g_object_new (SWFDEC_TYPE_GTK_PLAYER,
- "loader-type", SWFDEC_TYPE_GTK_LOADER, "socket-type", SWFDEC_TYPE_GTK_SOCKET,
- "debugger", debugger, NULL);
-
- return player;
-}
-
-static void
-swfdec_gtk_player_update_audio (SwfdecGtkPlayer *player)
-{
- gboolean should_play = player->audio_enabled;
-
- should_play &= (player->source != NULL);
- should_play &= (player->speed == 1.0);
-
- if (should_play && player->playback == NULL) {
- player->playback = swfdec_playback_open (SWFDEC_PLAYER (player),
- g_main_context_default ());
- } else if (!should_play && player->playback != NULL) {
- swfdec_playback_close (player->playback);
- player->playback = NULL;
- }
-}
-
-/**
- * swfdec_gtk_player_set_playing:
- * @player: a #SwfdecGtkPlayer
- * @playing: if the player should play or not
- *
- * Sets if @player should be playing or not. If the player is playing, a timer
- * will be attached to the default main loop that periodically calls
- * swfdec_player_advance().
- **/
-void
-swfdec_gtk_player_set_playing (SwfdecGtkPlayer *player, gboolean playing)
-{
- g_return_if_fail (SWFDEC_IS_GTK_PLAYER (player));
-
- if (playing && player->source == NULL) {
- player->source = swfdec_iterate_source_new (SWFDEC_PLAYER (player), player->speed);
- g_source_attach (player->source, NULL);
- } else if (!playing && player->source != NULL) {
- g_source_destroy (player->source);
- g_source_unref (player->source);
- player->source = NULL;
- }
- swfdec_gtk_player_update_audio (player);
- g_object_notify (G_OBJECT (player), "playing");
-}
-
-/**
- * swfdec_gtk_player_get_playing:
- * @player: a #SwfdecGtkPlayer
- *
- * Queries if the player is playing.
- *
- * Returns: %TRUE if the player is playing
- **/
-gboolean
-swfdec_gtk_player_get_playing (SwfdecGtkPlayer *player)
-{
- g_return_val_if_fail (SWFDEC_IS_GTK_PLAYER (player), FALSE);
-
- return player->source != NULL;
-}
-
-/**
- * swfdec_gtk_player_set_audio_enabled:
- * @player: a #SwfdecGtkPlayer
- * @enabled: %TRUE to enable audio
- *
- * Enables or disables automatic audio playback.
- **/
-void
-swfdec_gtk_player_set_audio_enabled (SwfdecGtkPlayer *player, gboolean enabled)
-{
- g_return_if_fail (SWFDEC_IS_GTK_PLAYER (player));
-
- if (player->audio_enabled == enabled)
- return;
- player->audio_enabled = enabled;
- swfdec_gtk_player_update_audio (player);
- g_object_notify (G_OBJECT (player), "audio-enabled");
-}
-
-/**
- * swfdec_gtk_player_get_audio_enabled:
- * @player: a #SwfdecGtkPlayer
- *
- * Queries if audio playback for @player is enabled or not.
- *
- * Returns: %TRUE if audio playback is enabled
- **/
-gboolean
-swfdec_gtk_player_get_audio_enabled (SwfdecGtkPlayer *player)
-{
- g_return_val_if_fail (SWFDEC_IS_GTK_PLAYER (player), FALSE);
-
- return player->audio_enabled;
-}
-
-/**
- * swfdec_gtk_player_set_speed:
- * @player: a #SwfdecGtkPlayer
- * @speed: the new playback speed
- *
- * Sets the new playback speed. 1.0 means the default speed, bigger values
- * make playback happen faster. Audio will only play back if the speed is
- * 1.0. Note that if the player is not playing when calling this function,
- * it will not automatically start.
- **/
-void
-swfdec_gtk_player_set_speed (SwfdecGtkPlayer *player, double speed)
-{
- g_return_if_fail (SWFDEC_IS_GTK_PLAYER (player));
- g_return_if_fail (speed > 0.0);
-
- player->speed = speed;
- swfdec_gtk_player_update_audio (player);
- if (player->source)
- swfdec_iterate_source_set_speed (player->source, player->speed);
- g_object_notify (G_OBJECT (player), "speed");
-}
-
-/**
- * swfdec_gtk_player_get_speed:
- * @player: a #SwfdecGtkPlayer
- *
- * Queries the current playback speed. If the player is currently paused, it
- * will report the speed that it would use if playing.
- *
- * Returns: the current playback speed.
- **/
-double
-swfdec_gtk_player_get_speed (SwfdecGtkPlayer *player)
-{
- g_return_val_if_fail (SWFDEC_IS_GTK_PLAYER (player), FALSE);
-
- return player->speed;
-}
diff --git a/libswfdec-gtk/swfdec_gtk_player.h b/libswfdec-gtk/swfdec_gtk_player.h
deleted file mode 100644
index 3ff77bf..0000000
--- a/libswfdec-gtk/swfdec_gtk_player.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_GTK_PLAYER_H_
-#define _SWFDEC_GTK_PLAYER_H_
-
-#include <libswfdec/swfdec.h>
-
-G_BEGIN_DECLS
-
-typedef struct _SwfdecGtkPlayer SwfdecGtkPlayer;
-typedef struct _SwfdecGtkPlayerClass SwfdecGtkPlayerClass;
-
-#define SWFDEC_TYPE_GTK_PLAYER (swfdec_gtk_player_get_type())
-#define SWFDEC_IS_GTK_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_GTK_PLAYER))
-#define SWFDEC_IS_GTK_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_GTK_PLAYER))
-#define SWFDEC_GTK_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_GTK_PLAYER, SwfdecGtkPlayer))
-#define SWFDEC_GTK_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_GTK_PLAYER, SwfdecGtkPlayerClass))
-#define SWFDEC_GTK_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_GTK_PLAYER, SwfdecGtkPlayerClass))
-
-GType swfdec_gtk_player_get_type (void);
-
-SwfdecPlayer * swfdec_gtk_player_new (SwfdecAsDebugger * debugger);
-
-void swfdec_gtk_player_set_playing (SwfdecGtkPlayer * player,
- gboolean playing);
-gboolean swfdec_gtk_player_get_playing (SwfdecGtkPlayer * player);
-void swfdec_gtk_player_set_audio_enabled
- (SwfdecGtkPlayer * player,
- gboolean enabled);
-gboolean swfdec_gtk_player_get_audio_enabled
- (SwfdecGtkPlayer * player);
-void swfdec_gtk_player_set_speed (SwfdecGtkPlayer * player,
- double speed);
-double swfdec_gtk_player_get_speed (SwfdecGtkPlayer * player);
-
-
-
-G_END_DECLS
-#endif
diff --git a/libswfdec-gtk/swfdec_gtk_socket.c b/libswfdec-gtk/swfdec_gtk_socket.c
deleted file mode 100644
index 08cbb76..0000000
--- a/libswfdec-gtk/swfdec_gtk_socket.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "swfdec_gtk_socket.h"
-#include <libsoup/soup.h>
-#include <libsoup/soup-address.h>
-
-/*** GTK-DOC ***/
-
-/**
- * SECTION:SwfdecGtkSocket
- * @title: SwfdecGtkSocket
- * @short_description: a socket implementation integrating into the Gtk main loop
- * @see_also: #SwfdecSocket, #SwfdecGtkPlayer
- *
- * #SwfdecGtkSocket is a #SwfdecSocket that is a socket implementation that
- * uses libsoup and integrates with the Gtk main loop. It is used by default
- * by the #SwfecGtkPlayer.
- */
-
-/**
- * SwfdecGtkSocket:
- *
- * This is the object used to represent a socket. It is completely private.
- */
-
-struct _SwfdecGtkSocket
-{
- SwfdecSocket socket;
-
- SoupSocket * sock; /* libsoup socket we're using */
- gboolean sock_writable; /* FALSE if writing would block */
- SwfdecBufferQueue * queue; /* buffers we still need to push */
-};
-
-struct _SwfdecGtkSocketClass {
- SwfdecSocketClass socket_class;
-};
-
-/*** SwfdecGtkSocket ***/
-
-G_DEFINE_TYPE (SwfdecGtkSocket, swfdec_gtk_socket, SWFDEC_TYPE_SOCKET)
-
-static void
-swfdec_gtk_socket_close (SwfdecStream *stream)
-{
- SwfdecGtkSocket *gtk = SWFDEC_GTK_SOCKET (stream);
-
- soup_socket_disconnect (gtk->sock);
-}
-
-static void
-swfdec_gtk_socket_do_connect (SoupSocket *sock, int status, SwfdecGtkSocket *gtk)
-{
- if (SOUP_STATUS_IS_SUCCESSFUL (status))
- swfdec_stream_open (SWFDEC_STREAM (gtk));
- else
- swfdec_stream_error (SWFDEC_STREAM (gtk), "error connecting");
-
-}
-
-static void
-swfdec_gtk_socket_do_disconnect (SoupSocket *sock, SwfdecGtkSocket *gtk)
-{
- swfdec_stream_eof (SWFDEC_STREAM (gtk));
-}
-
-static void
-swfdec_gtk_socket_do_read (SoupSocket *sock, SwfdecGtkSocket *gtk)
-{
-#define SWFDEC_GTK_SOCKET_BLOCK_SIZE 1024
- SwfdecBuffer *buffer;
- SoupSocketIOStatus status;
- gsize len;
-
- do {
- buffer = swfdec_buffer_new_and_alloc (SWFDEC_GTK_SOCKET_BLOCK_SIZE);
- status = soup_socket_read (sock, buffer, SWFDEC_GTK_SOCKET_BLOCK_SIZE, &len);
- buffer->length = len;
- switch (status) {
- case SOUP_SOCKET_OK:
- swfdec_stream_push (SWFDEC_STREAM (gtk), buffer);
- break;
- case SOUP_SOCKET_WOULD_BLOCK:
- case SOUP_SOCKET_EOF:
- swfdec_buffer_unref (buffer);
- break;
- case SOUP_SOCKET_ERROR:
- swfdec_buffer_unref (buffer);
- swfdec_stream_error (SWFDEC_STREAM (gtk), "error reading data");
- break;
- default:
- g_warning ("unhandled status code %u from soup_socket_read()", (guint) status);
- break;
- }
- } while (status == SOUP_SOCKET_OK);
-}
-
-static void
-swfdec_gtk_socket_do_write (SoupSocket *sock, SwfdecGtkSocket *gtk)
-{
- SwfdecBuffer *buffer;
- SoupSocketIOStatus status;
- gsize len;
-
- gtk->sock_writable = TRUE;
- while ((buffer = swfdec_buffer_queue_peek_buffer (gtk->queue))) {
- status = soup_socket_write (sock, buffer->data, buffer->length, &len);
- swfdec_buffer_unref (buffer);
- switch (status) {
- case SOUP_SOCKET_OK:
- buffer = swfdec_buffer_queue_pull (gtk->queue, len);
- swfdec_buffer_unref (buffer);
- break;
- case SOUP_SOCKET_WOULD_BLOCK:
- case SOUP_SOCKET_EOF:
- gtk->sock_writable = FALSE;
- break;
- case SOUP_SOCKET_ERROR:
- swfdec_stream_error (SWFDEC_STREAM (gtk), "error writing data");
- break;
- default:
- g_warning ("unhandled status code %u from soup_socket_read()", (guint) status);
- break;
- }
- };
-}
-
-static SwfdecSocket *
-swfdec_gtk_socket_create (const char *hostname, guint port)
-{
- SwfdecGtkSocket *sock = g_object_new (SWFDEC_TYPE_GTK_SOCKET, NULL);
- SoupAddress *addr;
-
- addr = soup_address_new (hostname, port);
- sock->sock = soup_socket_new (SOUP_SOCKET_FLAG_NONBLOCKING, TRUE,
- /* FIXME: we should set nodelay, no? */
- SOUP_SOCKET_FLAG_NODELAY, TRUE, NULL);
- g_signal_connect (sock->sock, "connect-result",
- G_CALLBACK (swfdec_gtk_socket_do_connect), socket);
- g_signal_connect (sock->sock, "disconnect",
- G_CALLBACK (swfdec_gtk_socket_do_disconnect), socket);
- g_signal_connect (sock->sock, "readable",
- G_CALLBACK (swfdec_gtk_socket_do_read), socket);
- g_signal_connect (sock->sock, "writable",
- G_CALLBACK (swfdec_gtk_socket_do_write), socket);
-
- return SWFDEC_SOCKET (sock);
-}
-
-static void
-swfdec_gtk_socket_send (SwfdecSocket *sock, SwfdecBuffer *buffer)
-{
- SwfdecGtkSocket *gtk = SWFDEC_GTK_SOCKET (sock);
-
- swfdec_buffer_queue_push (gtk->queue, buffer);
- if (gtk->sock_writable)
- swfdec_gtk_socket_do_write (gtk->sock, gtk);
-}
-
-static void
-swfdec_gtk_socket_dispose (GObject *object)
-{
- SwfdecGtkSocket *gtk = SWFDEC_GTK_SOCKET (object);
-
- if (gtk->sock) {
- g_signal_handlers_disconnect_matched (gtk->sock, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, gtk);
- g_object_unref (gtk->sock);
- gtk->sock = NULL;
- }
- if (gtk->queue) {
- swfdec_buffer_queue_unref (gtk->queue);
- gtk->queue = NULL;
- }
- G_OBJECT_CLASS (swfdec_gtk_socket_parent_class)->dispose (object);
-}
-
-static void
-swfdec_gtk_socket_class_init (SwfdecGtkSocketClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- SwfdecStreamClass *stream_class = SWFDEC_STREAM_CLASS (klass);
- SwfdecSocketClass *socket_class = SWFDEC_SOCKET_CLASS (klass);
-
- object_class->dispose = swfdec_gtk_socket_dispose;
-
- stream_class->close = swfdec_gtk_socket_close;
-
- socket_class->create = swfdec_gtk_socket_create;
- socket_class->send = swfdec_gtk_socket_send;
-}
-
-static void
-swfdec_gtk_socket_init (SwfdecGtkSocket *gtk)
-{
- gtk->sock_writable = TRUE;
- gtk->queue = swfdec_buffer_queue_new ();
-}
-
diff --git a/libswfdec-gtk/swfdec_gtk_socket.h b/libswfdec-gtk/swfdec_gtk_socket.h
deleted file mode 100644
index 62bb546..0000000
--- a/libswfdec-gtk/swfdec_gtk_socket.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_GTK_SOCKET_H_
-#define _SWFDEC_GTK_SOCKET_H_
-
-#include <libswfdec/swfdec.h>
-
-G_BEGIN_DECLS
-
-
-typedef struct _SwfdecGtkSocket SwfdecGtkSocket;
-typedef struct _SwfdecGtkSocketClass SwfdecGtkSocketClass;
-
-#define SWFDEC_TYPE_GTK_SOCKET (swfdec_gtk_socket_get_type())
-#define SWFDEC_IS_GTK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_GTK_SOCKET))
-#define SWFDEC_IS_GTK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_GTK_SOCKET))
-#define SWFDEC_GTK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_GTK_SOCKET, SwfdecGtkSocket))
-#define SWFDEC_GTK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_GTK_SOCKET, SwfdecGtkSocketClass))
-#define SWFDEC_GTK_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_GTK_SOCKET, SwfdecGtkSocketClass))
-
-GType swfdec_gtk_socket_get_type (void);
-
-
-G_END_DECLS
-#endif
diff --git a/libswfdec-gtk/swfdec_gtk_widget.c b/libswfdec-gtk/swfdec_gtk_widget.c
deleted file mode 100644
index 4836aa0..0000000
--- a/libswfdec-gtk/swfdec_gtk_widget.c
+++ /dev/null
@@ -1,683 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006-2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include <gdk/gdkkeysyms.h>
-#include "swfdec_gtk_widget.h"
-#include "swfdec_gtk_keys.h"
-
-struct _SwfdecGtkWidgetPrivate
-{
- SwfdecPlayer * player; /* the video we play */
-
- gboolean renderer_set; /* TRUE if a special renderer has been set */
- cairo_surface_type_t renderer; /* the renderer that was set */
- gboolean interactive; /* TRUE if this widget propagates keyboard and mouse events */
-};
-
-enum {
- PROP_0,
- PROP_PLAYER,
- PROP_INTERACTIVE,
- PROP_RENDERER_SET,
- PROP_RENDERER
-};
-
-/*** gtk-doc ***/
-
-/**
- * SECTION:SwfdecGtkWidget
- * @title: SwfdecGtkWidget
- * @short_description: a #GtkWidget for embedding SWF files
- *
- * This is a widget for playing Flash movies rendered with Swfdec in a Gtk
- * application. It supports a lot of advanced features, if you want to use
- * them. If you don't want to use them and just want to embed a movie in
- * your application, swfdec_gtk_widget_new() will probably be the only
- * function you need.
- *
- * @see_also: SwfdecGtkPlayer
- */
-
-/**
- * SwfdecGtkWidget:
- *
- * The structure for the Swfdec Gtk widget contains no public fields.
- */
-
-/*** SWFDEC_GTK_WIDGET ***/
-
-G_DEFINE_TYPE (SwfdecGtkWidget, swfdec_gtk_widget, GTK_TYPE_WIDGET)
-
-static gboolean
-swfdec_gtk_widget_motion_notify (GtkWidget *gtkwidget, GdkEventMotion *event)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (gtkwidget);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
- int x, y;
-
- gdk_window_get_pointer (gtkwidget->window, &x, &y, NULL);
-
- if (priv->interactive && priv->player)
- swfdec_player_mouse_move (priv->player, x, y);
-
- return FALSE;
-}
-
-static gboolean
-swfdec_gtk_widget_leave_notify (GtkWidget *gtkwidget, GdkEventCrossing *event)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (gtkwidget);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
-
- if (priv->interactive && priv->player) {
- swfdec_player_mouse_move (priv->player, event->x, event->y);
- }
- return FALSE;
-}
-
-static gboolean
-swfdec_gtk_widget_button_press (GtkWidget *gtkwidget, GdkEventButton *event)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (gtkwidget);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
-
- if (event->type == GDK_BUTTON_PRESS && event->button <= 32 && priv->interactive && priv->player) {
- swfdec_player_mouse_press (priv->player, event->x, event->y, event->button);
- }
- return FALSE;
-}
-
-static gboolean
-swfdec_gtk_widget_button_release (GtkWidget *gtkwidget, GdkEventButton *event)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (gtkwidget);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
-
- if (event->button <= 32 && priv->interactive && priv->player) {
- swfdec_player_mouse_release (priv->player, event->x, event->y, event->button);
- }
- return FALSE;
-}
-
-static guint
-swfdec_gtk_event_to_keycode (GdkEventKey *event)
-{
- guint ret;
-
- /* we try to match as well as possible to Flash _Windows_ key codes.
- * Since a lot of Flash files won't special case weird Linux key codes and we
- * want the best compatibility possible, we have to do that.
- */
- /* FIXME: I have no clue about non-western keyboards, so if you happen to use
- * such a keyboard, please help out here if it doesn't match.
- */
-
- /* try to match latin keys directly */
- if (event->keyval >= GDK_A && event->keyval <= GDK_Z)
- return event->keyval - GDK_A + SWFDEC_KEY_A;
- if (event->keyval >= GDK_a && event->keyval <= GDK_z)
- return event->keyval - GDK_a + SWFDEC_KEY_A;
-
- /* last resort: try to translate the hardware keycode directly */
- ret = swfdec_gtk_keycode_from_hardware_keycode (event->hardware_keycode);
- if (ret == 0)
- g_printerr ("could not translate key to Flash keycode. HW keycode %u, keyval %u\n",
- event->hardware_keycode, event->keyval);
- return ret;
-}
-
-static gboolean
-swfdec_gtk_widget_key_press (GtkWidget *gtkwidget, GdkEventKey *event)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (gtkwidget);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
-
- if (priv->interactive && priv->player) {
- guint keycode = swfdec_gtk_event_to_keycode (event);
- if (keycode != 0) {
- swfdec_player_key_press (priv->player, keycode,
- gdk_keyval_to_unicode (event->keyval));
- }
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-swfdec_gtk_widget_key_release (GtkWidget *gtkwidget, GdkEventKey *event)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (gtkwidget);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
-
- if (priv->interactive && priv->player) {
- guint keycode = swfdec_gtk_event_to_keycode (event);
- if (keycode != 0) {
- swfdec_player_key_release (priv->player, keycode,
- gdk_keyval_to_unicode (event->keyval));
- }
- return TRUE;
- }
-
- return FALSE;
-}
-
-static cairo_surface_t *
-swfdec_gtk_widget_create_renderer (cairo_surface_type_t type, int width, int height)
-{
- if (type == CAIRO_SURFACE_TYPE_IMAGE) {
- return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
- } else {
- return NULL;
- }
-}
-
-static gboolean
-swfdec_gtk_widget_expose (GtkWidget *gtkwidget, GdkEventExpose *event)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (gtkwidget);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
- cairo_t *cr;
- cairo_surface_t *surface = NULL;
-
- if (event->window != gtkwidget->window)
- return FALSE;
- if (priv->player == NULL)
- return FALSE;
-
- if (!priv->renderer_set ||
- (surface = swfdec_gtk_widget_create_renderer (priv->renderer,
- event->area.width, event->area.height)) == NULL) {
- cr = gdk_cairo_create (gtkwidget->window);
- } else {
- cr = cairo_create (surface);
- cairo_translate (cr, -event->area.x, -event->area.y);
- }
- swfdec_player_render (priv->player, cr,
- event->area.x, event->area.y, event->area.width, event->area.height);
- cairo_show_page (cr);
- cairo_destroy (cr);
-
- if (surface) {
- cairo_t *crw = gdk_cairo_create (gtkwidget->window);
- cairo_set_source_surface (crw, surface, event->area.x, event->area.y);
- cairo_paint (crw);
- cairo_destroy (crw);
- cairo_surface_destroy (surface);
- }
-
- return FALSE;
-}
-
-static void
-swfdec_gtk_widget_get_property (GObject *object, guint param_id, GValue *value,
- GParamSpec * pspec)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (object);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
-
- switch (param_id) {
- case PROP_PLAYER:
- g_value_set_object (value, priv->player);
- break;
- case PROP_INTERACTIVE:
- g_value_set_boolean (value, priv->interactive);
- break;
- case PROP_RENDERER_SET:
- g_value_set_boolean (value, priv->renderer_set);
- break;
- case PROP_RENDERER:
- g_value_set_uint (value, priv->renderer);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-swfdec_gtk_widget_set_property (GObject *object, guint param_id, const GValue *value,
- GParamSpec *pspec)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (object);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
-
- switch (param_id) {
- case PROP_PLAYER:
- swfdec_gtk_widget_set_player (widget, g_value_get_object (value));
- break;
- case PROP_INTERACTIVE:
- swfdec_gtk_widget_set_interactive (widget, g_value_get_boolean (value));
- break;
- case PROP_RENDERER_SET:
- priv->renderer_set = g_value_get_boolean (value);
- gtk_widget_queue_draw (GTK_WIDGET (widget));
- break;
- case PROP_RENDERER:
- priv->renderer = g_value_get_uint (value);
- if (priv->renderer_set)
- gtk_widget_queue_draw (GTK_WIDGET (widget));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-swfdec_gtk_widget_dispose (GObject *object)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (object);
-
- swfdec_gtk_widget_set_player (widget, NULL);
-
- G_OBJECT_CLASS (swfdec_gtk_widget_parent_class)->dispose (object);
-}
-
-static void
-swfdec_gtk_widget_size_allocate (GtkWidget *gtkwidget, GtkAllocation *allocation)
-{
- SwfdecGtkWidget *widget = SWFDEC_GTK_WIDGET (gtkwidget);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
-
- gtkwidget->allocation = *allocation;
-
- if (priv->player && swfdec_player_is_initialized (priv->player))
- swfdec_player_set_size (priv->player, allocation->width, allocation->height);
- if (GTK_WIDGET_REALIZED (gtkwidget)) {
- gdk_window_move_resize (gtkwidget->window,
- allocation->x, allocation->y, allocation->width, allocation->height);
- }
-}
-
-static void
-swfdec_gtk_widget_size_request (GtkWidget *gtkwidget, GtkRequisition *req)
-{
- SwfdecGtkWidget * widget = SWFDEC_GTK_WIDGET (gtkwidget);
- SwfdecGtkWidgetPrivate *priv = widget->priv;
-
- if (priv->player == NULL) {
- req->width = req->height = 0;
- } else {
- guint w, h;
- swfdec_player_get_default_size (priv->player, &w, &h);
- /* FIXME: set some sane upper limit here? */
- req->width = MIN (w, G_MAXINT);
- req->height = MIN (h, G_MAXINT);
- }
-}
-
-static void
-swfdec_gtk_widget_update_cursor (SwfdecGtkWidget *widget)
-{
- GdkWindow *window = GTK_WIDGET (widget)->window;
- GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (widget));
- SwfdecGtkWidgetPrivate *priv = widget->priv;
- SwfdecMouseCursor swfcursor;
- GdkCursor *cursor;
-
- if (window == NULL)
- return;
- if (priv->interactive)
- g_object_get (priv->player, "mouse-cursor", &swfcursor, NULL);
- else
- swfcursor = SWFDEC_MOUSE_CURSOR_NORMAL;
-
- switch (swfcursor) {
- case SWFDEC_MOUSE_CURSOR_NONE:
- {
- GdkBitmap *bitmap;
- GdkColor color = { 0, 0, 0, 0 };
- char data = 0;
-
- bitmap = gdk_bitmap_create_from_data (window, &data, 1, 1);
- if (bitmap == NULL)
- return;
- cursor = gdk_cursor_new_from_pixmap (bitmap, bitmap, &color, &color, 0, 0);
- gdk_window_set_cursor (window, cursor);
- gdk_cursor_unref (cursor);
- g_object_unref (bitmap);
- break;
- }
- case SWFDEC_MOUSE_CURSOR_TEXT:
- cursor = gdk_cursor_new_for_display (display, GDK_XTERM);
- gdk_window_set_cursor (window, cursor);
- gdk_cursor_unref (cursor);
- break;
- case SWFDEC_MOUSE_CURSOR_CLICK:
- cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
- gdk_window_set_cursor (window, cursor);
- gdk_cursor_unref (cursor);
- break;
- case SWFDEC_MOUSE_CURSOR_NORMAL:
- cursor = gdk_cursor_new_for_display (display, GDK_LEFT_PTR);
- gdk_window_set_cursor (window, cursor);
- gdk_cursor_unref (cursor);
- break;
- default:
- g_warning ("invalid cursor %d", (int) swfcursor);
- gdk_window_set_cursor (window, NULL);
- break;
- }
-}
-
-static void
-swfdec_gtk_widget_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_LEAVE_NOTIFY_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_KEY_PRESS_MASK |
- GDK_KEY_RELEASE_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- if (SWFDEC_GTK_WIDGET (widget)->priv->player) {
- swfdec_gtk_widget_update_cursor (SWFDEC_GTK_WIDGET (widget));
- }
-}
-
-static void
-swfdec_gtk_widget_class_init (SwfdecGtkWidgetClass * g_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (g_class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (g_class);
-
- object_class->dispose = swfdec_gtk_widget_dispose;
- object_class->get_property = swfdec_gtk_widget_get_property;
- object_class->set_property = swfdec_gtk_widget_set_property;
-
- g_object_class_install_property (object_class, PROP_PLAYER,
- g_param_spec_object ("player", "player", "player that is displayed",
- SWFDEC_TYPE_PLAYER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
- g_object_class_install_property (object_class, PROP_INTERACTIVE,
- g_param_spec_boolean ("interactive", "interactive", "if mouse events are processed",
- TRUE, G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_RENDERER_SET,
- g_param_spec_boolean ("renderer-set", "renderer set", "if an intermediate renderer should be used",
- TRUE, G_PARAM_READWRITE));
- /* FIXME: get an enum for cairo_surface_type_t */
- g_object_class_install_property (object_class, PROP_RENDERER,
- g_param_spec_uint ("renderer", "renderer", "cairo_surface_type_t of intermediate renderer to use",
- 0, G_MAXUINT, CAIRO_SURFACE_TYPE_IMAGE, G_PARAM_READWRITE));
-
- widget_class->realize = swfdec_gtk_widget_realize;
- widget_class->size_request = swfdec_gtk_widget_size_request;
- widget_class->size_allocate = swfdec_gtk_widget_size_allocate;
- widget_class->expose_event = swfdec_gtk_widget_expose;
- widget_class->button_press_event = swfdec_gtk_widget_button_press;
- widget_class->button_release_event = swfdec_gtk_widget_button_release;
- widget_class->motion_notify_event = swfdec_gtk_widget_motion_notify;
- widget_class->leave_notify_event = swfdec_gtk_widget_leave_notify;
- widget_class->key_press_event = swfdec_gtk_widget_key_press;
- widget_class->key_release_event = swfdec_gtk_widget_key_release;
-
- g_type_class_add_private (object_class, sizeof (SwfdecGtkWidgetPrivate));
-}
-
-static void
-swfdec_gtk_widget_init (SwfdecGtkWidget * widget)
-{
- SwfdecGtkWidgetPrivate *priv;
-
- priv = widget->priv = G_TYPE_INSTANCE_GET_PRIVATE (widget, SWFDEC_TYPE_GTK_WIDGET, SwfdecGtkWidgetPrivate);
-
- priv->interactive = TRUE;
- priv->renderer = CAIRO_SURFACE_TYPE_IMAGE;
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
-}
-
-static void
-swfdec_gtk_widget_invalidate_cb (SwfdecPlayer *player, const SwfdecRectangle *extents,
- const SwfdecRectangle *rect, guint n_rects, SwfdecGtkWidget *widget)
-{
- GdkRegion *region;
- guint i;
-
- if (!GTK_WIDGET_REALIZED (widget))
- return;
-
- region = gdk_region_new ();
- for (i = 0; i < n_rects; i++) {
- gdk_region_union_with_rect (region, (GdkRectangle *) &rect[i]);
- }
- gdk_window_invalidate_region (GTK_WIDGET (widget)->window, region, FALSE);
- gdk_region_destroy (region);
-}
-
-static void
-swfdec_gtk_widget_notify_cb (SwfdecPlayer *player, GParamSpec *pspec, SwfdecGtkWidget *widget)
-{
- if (g_str_equal (pspec->name, "mouse-cursor")) {
- swfdec_gtk_widget_update_cursor (widget);
- } else if (g_str_equal (pspec->name, "initialized")) {
- gtk_widget_queue_resize (GTK_WIDGET (widget));
- }
-}
-
-/*** PUBLIC API ***/
-
-/**
- * swfdec_gtk_widget_set_player:
- * @widget: a #SwfdecGtkWidget
- * @player: the #SwfdecPlayer to display or %NULL for none
- *
- * Sets the new player to display in @widget.
- **/
-void
-swfdec_gtk_widget_set_player (SwfdecGtkWidget *widget, SwfdecPlayer *player)
-{
- SwfdecGtkWidgetPrivate *priv = widget->priv;
-
- g_return_if_fail (SWFDEC_IS_GTK_WIDGET (widget));
- g_return_if_fail (player == NULL || SWFDEC_IS_PLAYER (player));
-
- if (priv->player) {
- g_signal_handlers_disconnect_by_func (priv->player, swfdec_gtk_widget_invalidate_cb, widget);
- g_signal_handlers_disconnect_by_func (priv->player, swfdec_gtk_widget_notify_cb, widget);
- g_object_unref (priv->player);
- }
- priv->player = player;
- if (player) {
- g_signal_connect (player, "invalidate", G_CALLBACK (swfdec_gtk_widget_invalidate_cb), widget);
- g_signal_connect (player, "notify", G_CALLBACK (swfdec_gtk_widget_notify_cb), widget);
- g_object_ref (player);
- swfdec_gtk_widget_update_cursor (widget);
- } else {
- if (GTK_WIDGET (widget)->window)
- gdk_window_set_cursor (GTK_WIDGET (widget)->window, NULL);
- }
- gtk_widget_queue_resize (GTK_WIDGET (widget));
- g_object_notify (G_OBJECT (widget), "player");
-}
-
-/**
- * swfdec_gtk_widget_get_player:
- * @widget: a #SwfdecGtkWidget
- *
- * Gets the player that is currently played back in this @widget.
- *
- * Returns: the #SwfdecPlayer or %NULL if none
- **/
-SwfdecPlayer *
-swfdec_gtk_widget_get_player (SwfdecGtkWidget *widget)
-{
- g_return_val_if_fail (SWFDEC_IS_GTK_WIDGET (widget), NULL);
-
- return widget->priv->player;
-}
-
-/**
- * swfdec_gtk_widget_new:
- * @player: a #SwfdecPlayer or %NULL
- *
- * Creates a new #SwfdecGtkWidget to display @player.
- *
- * Returns: the new widget that displays @player
- **/
-GtkWidget *
-swfdec_gtk_widget_new (SwfdecPlayer *player)
-{
- SwfdecGtkWidget *widget;
-
- g_return_val_if_fail (player == NULL || SWFDEC_IS_PLAYER (player), NULL);
-
- widget = g_object_new (SWFDEC_TYPE_GTK_WIDGET, "player", player, NULL);
-
- return GTK_WIDGET (widget);
-}
-
-/**
- * swfdec_gtk_widget_set_interactive:
- * @widget: a #SwfdecGtkWidget
- * @interactive: %TRUE to make the widget interactive
- *
- * Sets the widget to be interactive or not. An interactive widget processes
- * mouse and keyboard events, while a non-interactive widget does not care about
- * user input. Widgets are interactive by default.
- **/
-void
-swfdec_gtk_widget_set_interactive (SwfdecGtkWidget *widget, gboolean interactive)
-{
- g_return_if_fail (SWFDEC_IS_GTK_WIDGET (widget));
-
- widget->priv->interactive = interactive;
- swfdec_gtk_widget_update_cursor (widget);
- g_object_notify (G_OBJECT (widget), "interactive");
-}
-
-/**
- * swfdec_gtk_widget_get_interactive:
- * @widget: a #SwfdecGtkWidget
- *
- * Queries if the @widget is currently interactive. See
- * swfdec_gtk_widget_set_interactive() for details.
- *
- * Returns: %TRUE if the widget is interactive, %FALSE otherwise.
- **/
-gboolean
-swfdec_gtk_widget_get_interactive (SwfdecGtkWidget *widget)
-{
- g_return_val_if_fail (SWFDEC_IS_GTK_WIDGET (widget), FALSE);
-
- return widget->priv->interactive;
-}
-
-/**
- * swfdec_gtk_widget_set_renderer:
- * @widget: a #SwfdecGtkWidget
- * @renderer: a #cairo_surface_type_t for the intermediate renderer
- *
- * Tells @widget to use an intermediate surface for rendering. This is
- * useful for debugging or performance measurements inside swfdec and is
- * probably not interesting for anyone else.
- **/
-void
-swfdec_gtk_widget_set_renderer (SwfdecGtkWidget *widget, cairo_surface_type_t renderer)
-{
- g_return_if_fail (SWFDEC_IS_GTK_WIDGET (widget));
-
- widget->priv->renderer = renderer;
- if (widget->priv->renderer_set == FALSE) {
- widget->priv->renderer_set = TRUE;
- g_object_notify (G_OBJECT (widget), "renderer-set");
- }
- g_object_notify (G_OBJECT (widget), "renderer");
-}
-
-/**
- * swfdec_gtk_widget_unset_renderer:
- * @widget: a #SwfdecGtkWidget
- *
- * Unsets the use of an intermediate rendering surface. See
- * swfdec_gtk_widget_set_renderer() for details.
- **/
-void
-swfdec_gtk_widget_unset_renderer (SwfdecGtkWidget *widget)
-{
- g_return_if_fail (SWFDEC_IS_GTK_WIDGET (widget));
-
- if (widget->priv->renderer_set == FALSE)
- return;
- widget->priv->renderer_set = FALSE;
- g_object_notify (G_OBJECT (widget), "renderer-set");
-}
-
-/**
- * swfdec_gtk_widget_get_renderer:
- * @widget: a #SwfdecGtkWidget
- *
- * Gets the intermediate renderer that is or would be in use by @widget. Use
- * swfdec_gtk_widget_uses_renderer() to check if an intermediate renderer is in
- * use. See swfdec_gtk_widget_set_renderer() for details.
- *
- * Returns: the type of the intermediate renderer
- **/
-cairo_surface_type_t
-swfdec_gtk_widget_get_renderer (SwfdecGtkWidget *widget)
-{
- g_return_val_if_fail (SWFDEC_IS_GTK_WIDGET (widget), CAIRO_SURFACE_TYPE_IMAGE);
-
- return widget->priv->renderer;
-}
-
-/**
- * swfdec_gtk_widget_uses_renderer:
- * @widget: a #SwfdecGtkWidget
- *
- * Queries if an intermediate renderer set via swfdec_gtk_widget_set_renderer()
- * is currently in use.
- *
- * Returns: %TRUE if an intermediate renderer is used.
- **/
-gboolean
-swfdec_gtk_widget_uses_renderer (SwfdecGtkWidget *widget)
-{
- g_return_val_if_fail (SWFDEC_IS_GTK_WIDGET (widget), FALSE);
-
- return widget->priv->renderer_set;
-}
-
diff --git a/libswfdec-gtk/swfdec_gtk_widget.h b/libswfdec-gtk/swfdec_gtk_widget.h
deleted file mode 100644
index 86b03fd..0000000
--- a/libswfdec-gtk/swfdec_gtk_widget.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006-2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_GTK_WIDGET_H_
-#define _SWFDEC_GTK_WIDGET_H_
-
-#include <gtk/gtk.h>
-#include <libswfdec/swfdec.h>
-
-G_BEGIN_DECLS
-
-typedef struct _SwfdecGtkWidget SwfdecGtkWidget;
-typedef struct _SwfdecGtkWidgetClass SwfdecGtkWidgetClass;
-typedef struct _SwfdecGtkWidgetPrivate SwfdecGtkWidgetPrivate;
-
-#define SWFDEC_TYPE_GTK_WIDGET (swfdec_gtk_widget_get_type())
-#define SWFDEC_IS_GTK_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_GTK_WIDGET))
-#define SWFDEC_IS_GTK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_GTK_WIDGET))
-#define SWFDEC_GTK_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_GTK_WIDGET, SwfdecGtkWidget))
-#define SWFDEC_GTK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_GTK_WIDGET, SwfdecGtkWidgetClass))
-
-struct _SwfdecGtkWidget
-{
- GtkWidget widget;
-
- /*< private >*/
- SwfdecGtkWidgetPrivate * priv;
-};
-
-struct _SwfdecGtkWidgetClass
-{
- GtkWidgetClass widget_class;
-};
-
-GType swfdec_gtk_widget_get_type (void);
-
-GtkWidget * swfdec_gtk_widget_new (SwfdecPlayer * player);
-
-void swfdec_gtk_widget_set_player (SwfdecGtkWidget * widget,
- SwfdecPlayer * player);
-SwfdecPlayer * swfdec_gtk_widget_get_player (SwfdecGtkWidget * widget);
-void swfdec_gtk_widget_set_renderer (SwfdecGtkWidget * widget,
- cairo_surface_type_t renderer);
-void swfdec_gtk_widget_unset_renderer (SwfdecGtkWidget * widget);
-cairo_surface_type_t
- swfdec_gtk_widget_get_renderer (SwfdecGtkWidget * widget);
-gboolean swfdec_gtk_widget_uses_renderer (SwfdecGtkWidget * widget);
-void swfdec_gtk_widget_set_interactive (SwfdecGtkWidget * widget,
- gboolean interactive);
-gboolean swfdec_gtk_widget_get_interactive (SwfdecGtkWidget * widget);
-
-G_END_DECLS
-#endif
diff --git a/libswfdec-gtk/swfdec_playback.h b/libswfdec-gtk/swfdec_playback.h
deleted file mode 100644
index 8be67dd..0000000
--- a/libswfdec-gtk/swfdec_playback.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_PLAYBACK_H_
-#define _SWFDEC_PLAYBACK_H_
-
-#include <libswfdec/swfdec.h>
-
-G_BEGIN_DECLS
-
-typedef struct _SwfdecPlayback SwfdecPlayback;
-
-SwfdecPlayback *swfdec_playback_open (SwfdecPlayer * player,
- GMainContext * context);
-
-void swfdec_playback_close (SwfdecPlayback * sound);
-
-G_END_DECLS
-#endif
diff --git a/libswfdec-gtk/swfdec_playback_alsa.c b/libswfdec-gtk/swfdec_playback_alsa.c
deleted file mode 100644
index bddd189..0000000
--- a/libswfdec-gtk/swfdec_playback_alsa.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <alsa/asoundlib.h>
-#include "swfdec_playback.h"
-
-/* Why ALSA sucks for beginners:
- * - snd_pcm_delay is not sample-exact, but period-exact most of the time.
- * Yay for getting told the time every 512 samples when a human notices
- * a delay of 100 samples (oooops)
- * - lots of functions are simply not implemented. So the super-smart idea
- * of using snd_pcm_rewind to avoid XRUNS and still get low latency has
- * some issues when dmix just returns -EIO all of the time. That wouldn't
- * be so bad if there was actually a way to query if it's supported.
- * - But to make up for all this, you have 10 hardware parameters, 10
- * software parameters and 10 configuration parameters. All of this is
- * naturally supported on 10 driver APIs depending on kernel. So if your
- * sound card seems to do weird stuff, that is not my fault.
- * Welcome to Linux sound in the 21st century.
- */
-
-/*** DEFINITIONS ***/
-
-struct _SwfdecPlayback {
- SwfdecPlayer * player;
- GList * streams; /* all Stream objects */
- GMainContext * context; /* context we work in */
-};
-
-typedef struct {
- SwfdecPlayback * sound; /* reference to sound object */
- SwfdecAudio * audio; /* the audio we play back */
- snd_pcm_t * pcm; /* the pcm we play back to */
- GSource ** sources; /* sources for writing data */
- guint n_sources; /* number of sources */
- guint offset; /* offset into sound */
-} Stream;
-
-#define ALSA_TRY(func,msg) G_STMT_START{ \
- int err = func; \
- if (err < 0) \
- g_printerr (msg ": %s\n", snd_strerror (err)); \
-}G_STMT_END
-
-#define ALSA_ERROR(func,msg,retval) G_STMT_START { \
- int err = func; \
- if (err < 0) { \
- g_printerr (msg ": %s\n", snd_strerror (err)); \
- return retval; \
- } \
-}G_STMT_END
-
-/*** STREAMS ***/
-
-static snd_pcm_uframes_t
-write_player (Stream *stream, const snd_pcm_channel_area_t *dst,
- snd_pcm_uframes_t offset, snd_pcm_uframes_t avail)
-{
- /* FIXME: do a long path if this doesn't hold */
- g_assert (dst[1].first - dst[0].first == 16);
- g_assert (dst[0].addr == dst[1].addr);
- g_assert (dst[0].step == dst[1].step);
- g_assert (dst[0].step == 32);
-
- memset ((guint8 *) dst[0].addr + offset * dst[0].step / 8, 0, avail * 4);
- swfdec_audio_render (stream->audio, (gint16 *) ((guint8 *) dst[0].addr + offset * dst[0].step / 8),
- stream->offset, avail);
- //g_print ("rendering %u %u\n", stream->offset, (guint) avail);
- return avail;
-}
-
-static gboolean
-try_write (Stream *stream)
-{
- snd_pcm_sframes_t avail_result;
- snd_pcm_uframes_t offset, avail;
- const snd_pcm_channel_area_t *dst;
-
- while (TRUE) {
- avail_result = snd_pcm_avail_update (stream->pcm);
- ALSA_ERROR (avail_result, "snd_pcm_avail_update failed", FALSE);
- if (avail_result == 0)
- return TRUE;
- avail = avail_result;
- ALSA_ERROR (snd_pcm_mmap_begin (stream->pcm, &dst, &offset, &avail),
- "snd_pcm_mmap_begin failed", FALSE);
- //g_print (" avail = %u\n", (guint) avail);
-
- avail = write_player (stream, dst, offset, avail);
- if (snd_pcm_mmap_commit (stream->pcm, offset, avail) < 0) {
- g_printerr ("snd_pcm_mmap_commit failed\n");
- return FALSE;
- }
- stream->offset += avail;
- //g_print ("offset: %u (+%u)\n", stream->offset, (guint) avail);
- }
- return TRUE;
-}
-
-static void
-swfdec_playback_stream_remove_handlers (Stream *stream)
-{
- guint i;
-
- for (i = 0; i < stream->n_sources; i++) {
- if (stream->sources[i]) {
- g_source_destroy (stream->sources[i]);
- g_source_unref (stream->sources[i]);
- stream->sources[i] = NULL;
- }
- }
-}
-
-static void swfdec_playback_stream_start (Stream *stream);
-static gboolean
-handle_stream (GIOChannel *source, GIOCondition cond, gpointer data)
-{
- Stream *stream = data;
- snd_pcm_state_t state;
-
- state = snd_pcm_state (stream->pcm);
- if (state != SND_PCM_STATE_RUNNING) {
- swfdec_playback_stream_start (stream);
- } else {
- try_write (stream);
- }
- return TRUE;
-}
-
-static void
-swfdec_playback_stream_install_handlers (Stream *stream)
-{
- GIOChannel *channel;
-
- if (stream->n_sources > 0) {
- struct pollfd polls[stream->n_sources];
- guint i, count;
- if (stream->n_sources > 1)
- g_printerr ("attention: more than one fd!\n");
- count = snd_pcm_poll_descriptors (stream->pcm, polls, stream->n_sources);
- for (i = 0; i < count; i++) {
- if (stream->sources[i] != NULL)
- continue;
- channel = g_io_channel_unix_new (polls[i].fd);
- stream->sources[i] = g_io_create_watch (channel, polls[i].events);
- g_source_set_priority (stream->sources[i], G_PRIORITY_HIGH);
- g_source_set_callback (stream->sources[i], (GSourceFunc) handle_stream, stream, NULL);
- g_io_channel_unref (channel);
- g_source_attach (stream->sources[i], stream->sound->context);
- }
- }
-}
-
-static void
-swfdec_playback_stream_start (Stream *stream)
-{
- snd_pcm_state_t state = snd_pcm_state (stream->pcm);
- switch (state) {
- case SND_PCM_STATE_XRUN:
- ALSA_ERROR (snd_pcm_prepare (stream->pcm), "no prepare",);
- //g_print ("XRUN!\n");
- /* fall through */
- case SND_PCM_STATE_SUSPENDED:
- case SND_PCM_STATE_PREPARED:
- stream->offset = 0;
- //g_print ("offset: %u (delay: %ld)\n", sound->offset, delay);
- if (try_write (stream)) {
- ALSA_ERROR (snd_pcm_start (stream->pcm), "error starting",);
- swfdec_playback_stream_install_handlers (stream);
- }
- break;
- case SND_PCM_STATE_OPEN:
- case SND_PCM_STATE_SETUP:
- case SND_PCM_STATE_RUNNING:
- case SND_PCM_STATE_DRAINING:
- case SND_PCM_STATE_PAUSED:
- case SND_PCM_STATE_DISCONNECTED:
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
-swfdec_playback_stream_open (SwfdecPlayback *sound, SwfdecAudio *audio)
-{
- Stream *stream;
- snd_pcm_t *ret;
- snd_pcm_hw_params_t *hw_params;
- guint rate;
- snd_pcm_uframes_t uframes;
-
- /* "default" uses dmix, and dmix ticks way slow, so this thingy here stutters */
- ALSA_ERROR (snd_pcm_open (&ret, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK),
- "Failed to open sound device", );
-
- snd_pcm_hw_params_alloca (&hw_params);
- if (snd_pcm_hw_params_any (ret, hw_params) < 0) {
- g_printerr ("No sound format available\n");
- return;
- }
- if (snd_pcm_hw_params_set_access (ret, hw_params, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) {
- g_printerr ("Failed setting access\n");
- goto fail;
- }
- if (snd_pcm_hw_params_set_format (ret, hw_params, SND_PCM_FORMAT_S16) < 0) {
- g_printerr ("Failed setting format\n");
- goto fail;
- }
- if (snd_pcm_hw_params_set_channels (ret, hw_params, 2) < 0) {
- g_printerr ("Failed setting channels\n");
- goto fail;
- }
- rate = 44100;
- if (snd_pcm_hw_params_set_rate_near (ret, hw_params, &rate, 0) < 0) {
- g_printerr ("Failed setting rate\n");
- goto fail;
- }
- uframes = 16384;
- if (snd_pcm_hw_params_set_buffer_size_near (ret, hw_params, &uframes) < 0) {
- g_printerr ("Failed setting buffer size\n");
- goto fail;
- }
- if (snd_pcm_hw_params (ret, hw_params) < 0) {
- g_printerr ("Could not set hardware parameters\n");
- goto fail;
- }
-#if 0
- {
- snd_output_t *log;
- snd_output_stdio_attach (&log, stderr, 0);
- snd_pcm_hw_params_dump (hw_params, log);
- }
-#endif
- stream = g_new0 (Stream, 1);
- stream->sound = sound;
- stream->audio = g_object_ref (audio);
- stream->pcm = ret;
- stream->n_sources = snd_pcm_poll_descriptors_count (ret);
- if (stream->n_sources > 0)
- stream->sources = g_new0 (GSource *, stream->n_sources);
- sound->streams = g_list_prepend (sound->streams, stream);
- swfdec_playback_stream_start (stream);
- return;
-
-fail:
- snd_pcm_close (ret);
-}
-
-static void
-swfdec_playback_stream_close (Stream *stream)
-{
- ALSA_TRY (snd_pcm_close (stream->pcm), "failed closing");
- swfdec_playback_stream_remove_handlers (stream);
- g_free (stream->sources);
- stream->sound->streams = g_list_remove (stream->sound->streams, stream);
- g_object_unref (stream->audio);
- g_free (stream);
-}
-
-/*** SOUND ***/
-
-static void
-advance_before (SwfdecPlayer *player, guint msecs, guint audio_samples, gpointer data)
-{
- SwfdecPlayback *sound = data;
- GList *walk;
-
- for (walk = sound->streams; walk; walk = walk->next) {
- Stream *stream = walk->data;
- if (audio_samples >= stream->offset) {
- stream->offset = 0;
- } else {
- stream->offset -= audio_samples;
- }
- }
-}
-
-static void
-audio_added (SwfdecPlayer *player, SwfdecAudio *audio, SwfdecPlayback *sound)
-{
- swfdec_playback_stream_open (sound, audio);
-}
-
-static void
-audio_removed (SwfdecPlayer *player, SwfdecAudio *audio, SwfdecPlayback *sound)
-{
- GList *walk;
-
- for (walk = sound->streams; walk; walk = walk->next) {
- Stream *stream = walk->data;
- if (stream->audio == audio) {
- swfdec_playback_stream_close (stream);
- return;
- }
- }
-}
-
-SwfdecPlayback *
-swfdec_playback_open (SwfdecPlayer *player, GMainContext *context)
-{
- SwfdecPlayback *sound;
- const GList *walk;
-
- g_return_val_if_fail (SWFDEC_IS_PLAYER (player), NULL);
- g_return_val_if_fail (context != NULL, NULL);
-
- sound = g_new0 (SwfdecPlayback, 1);
- sound->player = player;
- g_signal_connect (player, "advance", G_CALLBACK (advance_before), sound);
- g_signal_connect (player, "audio-added", G_CALLBACK (audio_added), sound);
- g_signal_connect (player, "audio-removed", G_CALLBACK (audio_removed), sound);
- for (walk = swfdec_player_get_audio (player); walk; walk = walk->next) {
- swfdec_playback_stream_open (sound, walk->data);
- }
- g_main_context_ref (context);
- sound->context = context;
- return sound;
-}
-
-void
-swfdec_playback_close (SwfdecPlayback *sound)
-{
-#define REMOVE_HANDLER_FULL(obj,func,data,count) G_STMT_START {\
- if (g_signal_handlers_disconnect_by_func ((obj), \
- G_CALLBACK (func), (data)) != (count)) { \
- g_assert_not_reached (); \
- } \
-} G_STMT_END
-#define REMOVE_HANDLER(obj,func,data) REMOVE_HANDLER_FULL (obj, func, data, 1)
-
- while (sound->streams)
- swfdec_playback_stream_close (sound->streams->data);
- REMOVE_HANDLER (sound->player, advance_before, sound);
- REMOVE_HANDLER (sound->player, audio_added, sound);
- REMOVE_HANDLER (sound->player, audio_removed, sound);
- g_main_context_unref (sound->context);
- g_free (sound);
-}
-
-
diff --git a/libswfdec-gtk/swfdec_playback_none.c b/libswfdec-gtk/swfdec_playback_none.c
deleted file mode 100644
index 79651d6..0000000
--- a/libswfdec-gtk/swfdec_playback_none.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "swfdec_playback.h"
-
-/* STUBS ONLY - audio is disabled */
-
-SwfdecPlayback *
-swfdec_playback_open (SwfdecPlayer *player, GMainContext *context)
-{
- return GINT_TO_POINTER (-1);
-}
-
-void
-swfdec_playback_close (SwfdecPlayback *sound)
-{
- g_assert (sound == GINT_TO_POINTER (-1));
-}
diff --git a/libswfdec-gtk/swfdec_playback_oss.c b/libswfdec-gtk/swfdec_playback_oss.c
deleted file mode 100644
index c2eb493..0000000
--- a/libswfdec-gtk/swfdec_playback_oss.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* Swfdec
- * Copyright © 2006 Benjamin Otte <otte at gnome.org>
- * Copyright © 2007 Eric Anholt <eric at anholt.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <sys/soundcard.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "swfdec_playback.h"
-
-/** @file Implements swfdec audio playback by opening /dev/dsp per stream
- * and playing out through that.
- *
- * Allowing multiple access to /dev/dsp is not required by the OSS API spec,
- * but FreeBSD's sound system lets you, which is what this file was written
- * for.
- */
-
-/*** DEFINITIONS ***/
-
-struct _SwfdecPlayback {
- SwfdecPlayer * player;
- GList * streams; /* all Stream objects */
- GMainContext * context; /* context we work in */
-};
-
-typedef struct {
- SwfdecPlayback * sound; /* reference to sound object */
- SwfdecAudio * audio; /* the audio we play back */
- int dsp_fd;
- int fragsize; /* Audio fragment size */
- GSource * source; /* source for writing data */
- guint offset; /* offset into sound */
-} Stream;
-
-/* Size of one of our audio samples, in bytes */
-#define SAMPLESIZE 2
-#define CHANNELS 2
-
-/*** STREAMS ***/
-
-static gboolean
-handle_stream (GIOChannel *source, GIOCondition cond, gpointer data)
-{
- Stream *stream = data;
- char *frag = malloc(stream->fragsize);
-
- if (frag == NULL) {
- g_printerr ("Failed to allocate fragment of size %d\n",
- stream->fragsize);
- return FALSE;
- }
-
- while (TRUE) {
- int ret;
- audio_buf_info spaceinfo;
-
- ret = ioctl(stream->dsp_fd, SNDCTL_DSP_GETOSPACE, &spaceinfo);
- if (ret == -1) {
- g_printerr ("Failed to get output buffer availability\n");
- free(frag);
- return FALSE;
- }
- g_assert(spaceinfo.fragsize == stream->fragsize);
-
- if (spaceinfo.fragments == 0)
- break;
-
- memset (frag, 0, stream->fragsize);
- swfdec_audio_render (stream->audio, (gint16 *)frag, stream->offset,
- stream->fragsize / SAMPLESIZE / CHANNELS);
-
- ret = write (stream->dsp_fd, frag, stream->fragsize);
- if (ret != stream->fragsize) {
- g_printerr ("Failed to write fragment\n");
- free(frag);
- return FALSE;
- }
-
- stream->offset += stream->fragsize / SAMPLESIZE / CHANNELS;
- }
-
- free(frag);
-
- return TRUE;
-}
-
-static void
-swfdec_playback_stream_open (SwfdecPlayback *sound, SwfdecAudio *audio)
-{
- GIOChannel *channel;
- Stream *stream;
- guint rate;
- int dsp_fd, ret, format, channels, fragsize;
-
- dsp_fd = open("/dev/dsp", O_WRONLY);
- if (dsp_fd == -1) {
- g_printerr ("Failed to open /dev/dsp\n");
- return;
- }
-
- format = AFMT_S16_LE;
- ret = ioctl(dsp_fd, SNDCTL_DSP_SETFMT, &format);
- if (ret == -1) {
- g_printerr ("Failed to set sound format\n");
- close(dsp_fd);
- return;
- }
-
- channels = 2;
- ret = ioctl(dsp_fd, SNDCTL_DSP_CHANNELS, &channels);
- if (ret == -1) {
- g_printerr ("Failed to set stereo\n");
- close(dsp_fd);
- return;
- }
-
- rate = 44100;
- ret = ioctl(dsp_fd, SNDCTL_DSP_SPEED, &rate);
- if (ret == -1) {
- g_printerr ("Failed to set rate\n");
- close(dsp_fd);
- return;
- }
-
- ret = ioctl(dsp_fd, SNDCTL_DSP_GETBLKSIZE, &fragsize);
- if (ret == -1) {
- g_printerr ("Failed to get fragment size\n");
- close(dsp_fd);
- return;
- }
-
- stream = g_new0 (Stream, 1);
- stream->sound = sound;
- stream->audio = g_object_ref (audio);
- stream->dsp_fd = dsp_fd;
- stream->fragsize = fragsize;
- sound->streams = g_list_prepend (sound->streams, stream);
-
- channel = g_io_channel_unix_new (stream->dsp_fd);
- stream->source = g_io_create_watch (channel, G_IO_OUT);
- g_source_set_priority (stream->source, G_PRIORITY_HIGH);
- g_source_set_callback (stream->source, (GSourceFunc) handle_stream, stream,
- NULL);
- g_io_channel_unref (channel);
- g_source_attach (stream->source, stream->sound->context);
-
- return;
-}
-
-static void
-swfdec_playback_stream_close (Stream *stream)
-{
- close (stream->dsp_fd);
- g_source_destroy (stream->source);
- g_source_unref (stream->source);
- stream->sound->streams = g_list_remove (stream->sound->streams, stream);
- g_object_unref (stream->audio);
- g_free (stream);
-}
-
-/*** SOUND ***/
-
-static void
-advance_before (SwfdecPlayer *player, guint msecs, guint audio_samples, gpointer data)
-{
- SwfdecPlayback *sound = data;
- GList *walk;
-
- for (walk = sound->streams; walk; walk = walk->next) {
- Stream *stream = walk->data;
- if (audio_samples >= stream->offset) {
- stream->offset = 0;
- } else {
- stream->offset -= audio_samples;
- }
- }
-}
-
-static void
-audio_added (SwfdecPlayer *player, SwfdecAudio *audio, SwfdecPlayback *sound)
-{
- swfdec_playback_stream_open (sound, audio);
-}
-
-static void
-audio_removed (SwfdecPlayer *player, SwfdecAudio *audio, SwfdecPlayback *sound)
-{
- GList *walk;
-
- for (walk = sound->streams; walk; walk = walk->next) {
- Stream *stream = walk->data;
- if (stream->audio == audio) {
- swfdec_playback_stream_close (stream);
- return;
- }
- }
- g_assert_not_reached ();
-}
-
-SwfdecPlayback *
-swfdec_playback_open (SwfdecPlayer *player, GMainContext *context)
-{
- SwfdecPlayback *sound;
- const GList *walk;
-
- g_return_val_if_fail (SWFDEC_IS_PLAYER (player), NULL);
- g_return_val_if_fail (context != NULL, NULL);
-
- sound = g_new0 (SwfdecPlayback, 1);
- sound->player = player;
- g_signal_connect (player, "advance", G_CALLBACK (advance_before), sound);
- g_signal_connect (player, "audio-added", G_CALLBACK (audio_added), sound);
- g_signal_connect (player, "audio-removed", G_CALLBACK (audio_removed), sound);
- for (walk = swfdec_player_get_audio (player); walk; walk = walk->next) {
- swfdec_playback_stream_open (sound, walk->data);
- }
- g_main_context_ref (context);
- sound->context = context;
- return sound;
-}
-
-void
-swfdec_playback_close (SwfdecPlayback *sound)
-{
-#define REMOVE_HANDLER_FULL(obj,func,data,count) G_STMT_START {\
- if (g_signal_handlers_disconnect_by_func ((obj), \
- G_CALLBACK (func), (data)) != (count)) { \
- g_assert_not_reached (); \
- } \
-} G_STMT_END
-#define REMOVE_HANDLER(obj,func,data) REMOVE_HANDLER_FULL (obj, func, data, 1)
-
- while (sound->streams)
- swfdec_playback_stream_close (sound->streams->data);
- REMOVE_HANDLER (sound->player, advance_before, sound);
- REMOVE_HANDLER (sound->player, audio_added, sound);
- REMOVE_HANDLER (sound->player, audio_removed, sound);
- g_main_context_unref (sound->context);
- g_free (sound);
-}
-
-
diff --git a/libswfdec-gtk/swfdec_playback_pa.c b/libswfdec-gtk/swfdec_playback_pa.c
deleted file mode 100644
index 755b033..0000000
--- a/libswfdec-gtk/swfdec_playback_pa.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/* Swfdec
- * Copyright © 2006 Benjamin Otte <otte at gnome.org>
- * Copyright © 2007 Eric Anholt <eric at anholt.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "swfdec_playback.h"
-#include "pulse/pulseaudio.h"
-#include "pulse/glib-mainloop.h"
-
-/** @file Implements swfdec audio playback by dumping swfdec streams out
- * using pulseaudio streams.
- */
-
-/*** DEFINITIONS ***/
-
-struct _SwfdecPlayback {
- SwfdecPlayer * player;
- GList * streams; /* all Stream objects */
- GMainContext * context; /* glib context we work in */
- pa_glib_mainloop * pa_mainloop; /* PA to glib mainloop connection */
- pa_context * pa; /* PA context for sound rendering */
-};
-
-typedef struct {
- SwfdecPlayback * sound; /* reference to sound object */
- SwfdecAudio * audio; /* the audio we play back */
- guint offset; /* offset into sound */
- pa_stream * pa; /* PA stream */
- pa_cvolume volume; /* Volume control. Not yet used. */
- gboolean no_more;
-} Stream;
-
-/* Size of one of our audio samples, in bytes */
-#define SAMPLESIZE 2
-#define CHANNELS 2
-
-/*** STREAMS ***/
-
-static void
-stream_write_callback (pa_stream *pa,
- size_t bytes,
- void *data)
-{
- Stream *stream = data;
- char *frag;
- unsigned int samples = bytes / SAMPLESIZE / CHANNELS;
- int err;
-
- if (stream->no_more)
- return;
-
- /* Adjust to our rounded-down number */
- bytes = samples * SAMPLESIZE * CHANNELS;
-
- frag = malloc (bytes);
- if (frag == NULL) {
- g_printerr ("Failed to allocate fragment of size %d\n", (int)bytes);
- return;
- }
-
- /* Set up our fragment and render swfdec's audio into it. The swfdec audio
- * decoder renders deltas from the existing data in the fragment.
- */
- memset (frag, 0, bytes);
- swfdec_audio_render (stream->audio, (gint16 *)frag, stream->offset,
- samples);
-
- /* Send the new fragment out the PA stream */
- err = pa_stream_write (pa, frag, bytes, NULL, 0, PA_SEEK_RELATIVE);
- if (err != 0) {
- g_printerr ("Failed to write fragment to PA stream: %s\n",
- pa_strerror(pa_context_errno(stream->sound->pa)));
- }
-
- /* Advance playback pointer */
- stream->offset += samples;
-
- free(frag);
-}
-
-static void
-stream_drain_complete (pa_stream *pa, int success, void *data)
-{
- Stream *stream = data;
-
- pa_stream_disconnect (stream->pa);
- pa_stream_unref (stream->pa);
- g_object_unref (stream->audio);
- g_free (stream);
-}
-
-static void
-swfdec_playback_stream_close (Stream *stream)
-{
- /* Pull it off of the active stream list. */
- stream->sound->streams = g_list_remove (stream->sound->streams, stream);
-
- /* If we have created a PA stream, defer freeing until we drain it. */
- if (stream->pa != NULL) {
- stream->no_more = 1;
- pa_operation_unref (pa_stream_drain (stream->pa,
- stream_drain_complete,
- stream));
- } else {
- g_object_unref (stream->audio);
- g_free (stream);
- }
-}
-
-static void
-stream_state_callback (pa_stream *pa, void *data)
-{
- switch (pa_stream_get_state(pa)) {
- case PA_STREAM_CREATING:
- case PA_STREAM_TERMINATED:
- case PA_STREAM_READY:
- case PA_STREAM_UNCONNECTED:
- break;
-
- case PA_STREAM_FAILED:
- g_printerr("PA stream failed: %s\n",
- pa_strerror(pa_context_errno(pa_stream_get_context(pa))));
- default:
- break;
- }
-}
-
-static void
-swfdec_playback_stream_open (SwfdecPlayback *sound, SwfdecAudio *audio)
-{
- Stream *stream;
- pa_sample_spec spec = {
- .format = PA_SAMPLE_S16LE,
- .rate = 44100,
- .channels = CHANNELS,
- };
- int err;
-
- stream = g_new0 (Stream, 1);
- stream->sound = sound;
- stream->audio = g_object_ref (audio);
- sound->streams = g_list_prepend (sound->streams, stream);
-
- /* If we failed to initialize the context, don't try to create the stream.
- * We still have to get put in the list, because swfdec_playback.c expects
- * to find it in the list for removal later.
- */
- if (sound->pa == NULL)
- return;
-
- /* Create our stream */
- stream->pa = pa_stream_new(sound->pa,
- "swfdec stream",
- &spec,
- NULL /* Default channel map */
- );
- if (stream->pa == NULL) {
- g_printerr("Failed to create PA stream\n");
- swfdec_playback_stream_close(stream);
- return;
- }
-
- /* Start at default volume */
- pa_cvolume_set(&stream->volume, CHANNELS, PA_VOLUME_NORM);
-
- /* Hook up our stream write callback for when new data is needed */
- pa_stream_set_state_callback(stream->pa, stream_state_callback, stream);
- pa_stream_set_write_callback(stream->pa, stream_write_callback, stream);
-
- /* Connect it up as a playback stream. */
- err = pa_stream_connect_playback(stream->pa,
- NULL, /* Default device */
- NULL /* Default buffering */,
- 0, /* No flags */
- &stream->volume,
- NULL /* Don't sync to any stream */
- );
- if (err != 0) {
- g_printerr ("Failed to connect PA stream: %s\n",
- pa_strerror(pa_context_errno(sound->pa)));
- swfdec_playback_stream_close(stream);
- return;
- }
-}
-
-/*** SOUND ***/
-
-static void
-advance_before (SwfdecPlayer *player, guint msecs, guint audio_samples, gpointer data)
-{
- SwfdecPlayback *sound = data;
- GList *walk;
-
- for (walk = sound->streams; walk; walk = walk->next) {
- Stream *stream = walk->data;
- if (audio_samples >= stream->offset) {
- stream->offset = 0;
- } else {
- stream->offset -= audio_samples;
- }
- }
-}
-
-static void
-audio_added (SwfdecPlayer *player, SwfdecAudio *audio, SwfdecPlayback *sound)
-{
- swfdec_playback_stream_open (sound, audio);
-}
-
-static void
-audio_removed (SwfdecPlayer *player, SwfdecAudio *audio, SwfdecPlayback *sound)
-{
- GList *walk;
-
- for (walk = sound->streams; walk; walk = walk->next) {
- Stream *stream = walk->data;
- if (stream->audio == audio) {
- swfdec_playback_stream_close (stream);
- return;
- }
- }
- g_assert_not_reached ();
-}
-static void
-context_state_callback (pa_context *pa, void *data)
-{
- SwfdecPlayback *sound = data;
-
- switch (pa_context_get_state(pa)) {
- case PA_CONTEXT_FAILED:
- g_printerr ("PA context failed\n");
- pa_context_unref (pa);
- sound->pa = NULL;
- break;
-
- default:
- case PA_CONTEXT_TERMINATED:
- case PA_CONTEXT_UNCONNECTED:
- case PA_CONTEXT_CONNECTING:
- case PA_CONTEXT_AUTHORIZING:
- case PA_CONTEXT_SETTING_NAME:
- case PA_CONTEXT_READY:
- break;
-
- }
-}
-
-SwfdecPlayback *
-swfdec_playback_open (SwfdecPlayer *player, GMainContext *context)
-{
- SwfdecPlayback *sound;
- const GList *walk;
- pa_mainloop_api *pa_api;
-
- g_return_val_if_fail (SWFDEC_IS_PLAYER (player), NULL);
- g_return_val_if_fail (context != NULL, NULL);
-
- sound = g_new0 (SwfdecPlayback, 1);
- sound->player = player;
- g_signal_connect (player, "advance", G_CALLBACK (advance_before), sound);
- g_signal_connect (player, "audio-added", G_CALLBACK (audio_added), sound);
- g_signal_connect (player, "audio-removed", G_CALLBACK (audio_removed), sound);
-
- /* Create our mainloop attachment to glib. XXX: I hope this means we don't
- * have to run the main loop using pa functions.
- */
- sound->pa_mainloop = pa_glib_mainloop_new (context);
- pa_api = pa_glib_mainloop_get_api (sound->pa_mainloop);
-
- sound->pa = pa_context_new (pa_api, "swfdec");
-
- pa_context_set_state_callback (sound->pa, context_state_callback, sound);
- pa_context_connect (sound->pa,
- NULL, /* default server */
- 0, /* default flags */
- NULL /* spawning api */
- );
-
- for (walk = swfdec_player_get_audio (player); walk; walk = walk->next) {
- swfdec_playback_stream_open (sound, walk->data);
- }
- g_main_context_ref (context);
- sound->context = context;
- return sound;
-}
-
-static void
-context_drain_complete (pa_context *pa, void *data)
-{
- pa_context_disconnect (pa);
- pa_context_unref (pa);
-}
-
-void
-swfdec_playback_close (SwfdecPlayback *sound)
-{
- pa_operation *op;
-
-#define REMOVE_HANDLER_FULL(obj,func,data,count) G_STMT_START {\
- if (g_signal_handlers_disconnect_by_func ((obj), \
- G_CALLBACK (func), (data)) != (count)) { \
- g_assert_not_reached (); \
- } \
-} G_STMT_END
-#define REMOVE_HANDLER(obj,func,data) REMOVE_HANDLER_FULL (obj, func, data, 1)
-
- while (sound->streams)
- swfdec_playback_stream_close (sound->streams->data);
- REMOVE_HANDLER (sound->player, advance_before, sound);
- REMOVE_HANDLER (sound->player, audio_added, sound);
- REMOVE_HANDLER (sound->player, audio_removed, sound);
-
- if (sound->pa != NULL) {
- op = pa_context_drain (sound->pa, context_drain_complete, NULL);
- if (op == NULL) {
- pa_context_disconnect (sound->pa);
- pa_context_unref (sound->pa);
- } else {
- pa_operation_unref (op);
- }
- pa_glib_mainloop_free (sound->pa_mainloop);
- }
-
- g_main_context_unref (sound->context);
- g_free (sound);
-}
-
-
diff --git a/libswfdec-gtk/swfdec_source.c b/libswfdec-gtk/swfdec_source.c
deleted file mode 100644
index 471b99b..0000000
--- a/libswfdec-gtk/swfdec_source.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "swfdec_source.h"
-
-static glong
-my_time_val_difference (const GTimeVal *compare, const GTimeVal *now)
-{
- return (compare->tv_sec - now->tv_sec) * 1000 +
- (compare->tv_usec - now->tv_usec) / 1000;
-}
-
-/*** SwfdecIterateSource ***/
-
-typedef struct _SwfdecIterateSource SwfdecIterateSource;
-struct _SwfdecIterateSource {
- GSource source;
- SwfdecPlayer * player; /* player we manage or NULL if player was deleted */
- double speed; /* inverse playback speed (so 0.5 means double speed) */
- gulong notify; /* set for iterate notifications (only valid when player != NULL) */
- GTimeVal last; /* last time */
-};
-
-static glong
-swfdec_iterate_get_msecs_to_next_event (GSource *source_)
-{
- SwfdecIterateSource *source = (SwfdecIterateSource *) source_;
- GTimeVal now;
- glong diff;
-
- g_assert (source->player);
- diff = swfdec_player_get_next_event (source->player);
- if (diff == -1)
- return G_MAXLONG;
- diff *= source->speed;
- g_source_get_current_time (source_, &now);
- /* should really add to source->last instead of subtracting from now */
- g_time_val_add (&now, -diff * 1000);
- diff = my_time_val_difference (&source->last, &now);
-
- return diff;
-}
-
-static gboolean
-swfdec_iterate_prepare (GSource *source, gint *timeout)
-{
- glong diff;
-
- diff = swfdec_iterate_get_msecs_to_next_event (source);
- if (((SwfdecIterateSource *) source)->player == NULL) {
- *timeout = 0;
- return TRUE;
- }
-
- if (diff == G_MAXLONG) {
- *timeout = -1;
- return FALSE;
- } else if (diff <= 0) {
- *timeout = 0;
- return TRUE;
- } else {
- *timeout = diff;
- return FALSE;
- }
-}
-
-static gboolean
-swfdec_iterate_check (GSource *source)
-{
- glong diff;
-
- if (((SwfdecIterateSource *) source)->player == NULL)
- return 0;
- diff = swfdec_iterate_get_msecs_to_next_event (source);
- return diff < 0;
-}
-
-static gboolean
-swfdec_iterate_dispatch (GSource *source_, GSourceFunc callback, gpointer user_data)
-{
- SwfdecIterateSource *source = (SwfdecIterateSource *) source_;
- glong diff;
-
- if (source->player == NULL)
- return FALSE;
- diff = swfdec_iterate_get_msecs_to_next_event (source_);
- if (diff > 0)
- return TRUE;
- diff = swfdec_player_get_next_event (source->player) - diff;
- swfdec_player_advance (source->player, diff);
- return TRUE;
-}
-
-static void
-swfdec_iterate_finalize (GSource *source_)
-{
- SwfdecIterateSource *source = (SwfdecIterateSource *) source_;
-
- if (source->notify && source->player) {
- g_signal_handler_disconnect (source->player, source->notify);
- }
- if (source->player) {
- g_object_remove_weak_pointer (G_OBJECT (source->player), (gpointer) &source->player);
- }
-}
-
-GSourceFuncs swfdec_iterate_funcs = {
- swfdec_iterate_prepare,
- swfdec_iterate_check,
- swfdec_iterate_dispatch,
- swfdec_iterate_finalize
-};
-
-static void
-swfdec_iterate_source_advance_cb (SwfdecPlayer *player, guint msecs,
- guint audio_frames, SwfdecIterateSource *source)
-{
- g_time_val_add (&source->last, msecs * 1000 * source->speed);
-}
-
-GSource *
-swfdec_iterate_source_new (SwfdecPlayer *player, double speed)
-{
- SwfdecIterateSource *source;
-
- g_return_val_if_fail (SWFDEC_IS_PLAYER (player), NULL);
- g_return_val_if_fail (speed > 0.0, NULL);
-
- source = (SwfdecIterateSource *) g_source_new (&swfdec_iterate_funcs,
- sizeof (SwfdecIterateSource));
- source->player = player;
- g_object_add_weak_pointer (G_OBJECT (source->player), (gpointer) &source->player);
- source->speed = 1.0 / speed;
- source->notify = g_signal_connect (player, "advance",
- G_CALLBACK (swfdec_iterate_source_advance_cb), source);
- g_get_current_time (&source->last);
-
- return (GSource *) source;
-}
-
-void
-swfdec_iterate_source_set_speed (GSource *source, double speed)
-{
- /* FIXME: need a return_if_fail if wrong source? */
- g_return_if_fail (speed > 0.0);
-
- ((SwfdecIterateSource *) source)->speed = 1.0 / speed;
-}
-
-guint
-swfdec_iterate_add (SwfdecPlayer *player)
-{
- GSource *source;
- guint id;
-
- g_return_val_if_fail (SWFDEC_IS_PLAYER (player), 0);
-
- source = swfdec_iterate_source_new (player, 1.0);
-
- id = g_source_attach (source, NULL);
- g_source_unref (source);
-
- return id;
-}
diff --git a/libswfdec-gtk/swfdec_source.h b/libswfdec-gtk/swfdec_source.h
deleted file mode 100644
index 0c7c383..0000000
--- a/libswfdec-gtk/swfdec_source.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_SOURCE_H_
-#define _SWFDEC_SOURCE_H_
-
-#include <libswfdec/swfdec.h>
-
-G_BEGIN_DECLS
-
-GSource * swfdec_iterate_source_new (SwfdecPlayer * player,
- double speed);
-void swfdec_iterate_source_set_speed (GSource * source,
- double speed);
-guint swfdec_iterate_add (SwfdecPlayer * player);
-
-G_END_DECLS
-#endif
diff --git a/libswfdec/.gitignore b/libswfdec/.gitignore
deleted file mode 100644
index 9f923f0..0000000
--- a/libswfdec/.gitignore
+++ /dev/null
@@ -1,19 +0,0 @@
-*~
-CVS
-.cvsignore
-.deps
-.libs
-
-Makefile
-Makefile.in
-*.o
-*.la
-*.lo
-*.loT
-
-swfdec_as_strings.h
-swfdec_asnative.h
-swfdec_enums.[ch]
-swfdec_marshal.[ch]
-
-compiler
diff --git a/libswfdec/Makefile.am b/libswfdec/Makefile.am
deleted file mode 100644
index dc62604..0000000
--- a/libswfdec/Makefile.am
+++ /dev/null
@@ -1,372 +0,0 @@
-SUBDIRS = jpeg
-
-CODECS =
-
-if HAVE_FFMPEG
-CODECS += swfdec_codec_ffmpeg.c
-endif
-if HAVE_GST
-CODECS += swfdec_codec_gst.c
-endif
-if HAVE_MAD
-CODECS += swfdec_codec_mad.c
-endif
-
-lib_LTLIBRARIES = libswfdec- at SWFDEC_MAJORMINOR@.la
-
-# these are files that must be in SRCDIR
-libswfdec_source_files = \
- swfdec_accessibility.c \
- swfdec_as_array.c \
- swfdec_as_boolean.c \
- swfdec_as_context.c \
- swfdec_as_date.c \
- swfdec_as_debugger.c \
- swfdec_as_frame.c \
- swfdec_as_function.c \
- swfdec_as_interpret.c \
- swfdec_as_math.c \
- swfdec_as_native_function.c \
- swfdec_as_number.c \
- swfdec_as_object.c \
- swfdec_as_script_function.c \
- swfdec_as_stack.c \
- swfdec_as_string.c \
- swfdec_as_strings.c \
- swfdec_as_super.c \
- swfdec_as_types.c \
- swfdec_amf.c \
- swfdec_asbroadcaster.c \
- swfdec_audio.c \
- swfdec_audio_event.c \
- swfdec_audio_flv.c \
- swfdec_audio_stream.c \
- swfdec_bevel_filter.c \
- swfdec_bitmap_data.c \
- swfdec_bitmap_filter.c \
- swfdec_bits.c \
- swfdec_blur_filter.c \
- swfdec_buffer.c \
- swfdec_button.c \
- swfdec_button_movie.c \
- swfdec_button_movie_as.c \
- swfdec_cache.c \
- swfdec_cached.c \
- swfdec_camera.c \
- swfdec_character.c \
- swfdec_codec_adpcm.c \
- swfdec_codec_audio.c \
- $(CODECS) \
- swfdec_codec_screen.c \
- swfdec_codec_video.c \
- swfdec_codec_vp6_alpha.c \
- swfdec_color.c \
- swfdec_color_as.c \
- swfdec_color_matrix_filter.c \
- swfdec_color_transform.c \
- swfdec_convolution_filter.c \
- swfdec_debug.c \
- swfdec_decoder.c \
- swfdec_displacement_map_filter.c \
- swfdec_draw.c \
- swfdec_drop_shadow_filter.c \
- swfdec_event.c \
- swfdec_external_interface.c \
- swfdec_file_loader.c \
- swfdec_file_reference.c \
- swfdec_file_reference_list.c \
- swfdec_filter.c \
- swfdec_filter_as.c \
- swfdec_flv_decoder.c \
- swfdec_font.c \
- swfdec_function_list.c \
- swfdec_glow_filter.c \
- swfdec_gradient_filter.c \
- swfdec_gradient_pattern.c \
- swfdec_graphic.c \
- swfdec_graphic_movie.c \
- swfdec_image.c \
- swfdec_image_decoder.c \
- swfdec_interval.c \
- swfdec_key_as.c \
- swfdec_load_object.c \
- swfdec_load_object_as.c \
- swfdec_loader.c \
- swfdec_loadvars_as.c \
- swfdec_local_connection.c \
- swfdec_microphone.c \
- swfdec_morph_movie.c \
- swfdec_morphshape.c \
- swfdec_mouse_as.c \
- swfdec_movie.c \
- swfdec_movie_as_drawing.c \
- swfdec_movie_asprops.c \
- swfdec_movie_clip_loader.c \
- swfdec_net_connection.c \
- swfdec_net_stream.c \
- swfdec_net_stream_as.c \
- swfdec_path.c \
- swfdec_pattern.c \
- swfdec_player.c \
- swfdec_player_as.c \
- swfdec_player_scripting.c \
- swfdec_print_job.c \
- swfdec_policy_file.c \
- swfdec_rect.c \
- swfdec_rectangle.c \
- swfdec_resource.c \
- swfdec_ringbuffer.c \
- swfdec_sandbox.c \
- swfdec_script.c \
- swfdec_selection.c \
- swfdec_shape.c \
- swfdec_shape_parser.c \
- swfdec_shared_object.c \
- swfdec_socket.c \
- swfdec_sound.c \
- swfdec_sound_object.c \
- swfdec_sprite.c \
- swfdec_sprite_movie.c \
- swfdec_sprite_movie_as.c \
- swfdec_stage_as.c \
- swfdec_stream.c \
- swfdec_stream_target.c \
- swfdec_stroke.c \
- swfdec_style_sheet.c \
- swfdec_swf_decoder.c \
- swfdec_system.c \
- swfdec_system_as.c \
- swfdec_system_ime.c \
- swfdec_system_security.c \
- swfdec_tag.c \
- swfdec_text.c \
- swfdec_text_field.c \
- swfdec_text_field_movie.c \
- swfdec_text_field_movie_as.c \
- swfdec_text_field_movie_html.c \
- swfdec_text_format.c \
- swfdec_text_renderer.c \
- swfdec_text_snapshot.c \
- swfdec_transform.c \
- swfdec_url.c \
- swfdec_utils.c \
- swfdec_video.c \
- swfdec_video_movie.c \
- swfdec_video_movie_as.c \
- swfdec_xml_node.c \
- swfdec_xml.c \
- swfdec_xml_socket.c
-
-libswfdec_ at SWFDEC_MAJORMINOR@_la_SOURCES = \
- $(libswfdec_source_files) \
- swfdec_enums.c \
- swfdec_marshal.c
-
-libswfdec_ at SWFDEC_MAJORMINOR@_la_CFLAGS = \
- $(GLOBAL_CFLAGS) $(CAIRO_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) \
- -I$(top_srcdir) -I$(srcdir)/jpeg/ $(LIBOIL_CFLAGS) \
- $(GST_CFLAGS) $(FFMPEG_CFLAGS) $(MAD_CFLAGS) \
- -DG_LOG_DOMAIN=\"Swfdec\"
-libswfdec_ at SWFDEC_MAJORMINOR@_la_LDFLAGS = \
- $(SYMBOLIC_LDFLAGS) \
- -version-info $(SWFDEC_LIBVERSION) \
- -export-symbols-regex '^(swfdec_.*)' \
- $(CAIRO_LIBS) $(GLIB_LIBS) $(PANGO_LIBS) $(LIBOIL_LIBS) -lz \
- $(MAD_LIBS) $(FFMPEG_LIBS) $(GST_LIBS)
-
-public_headers = \
- swfdec.h \
- swfdec_as_array.h \
- swfdec_as_context.h \
- swfdec_as_debugger.h \
- swfdec_as_frame.h \
- swfdec_as_function.h \
- swfdec_as_native_function.h \
- swfdec_as_object.h \
- swfdec_as_types.h \
- swfdec_audio.h \
- swfdec_buffer.h \
- swfdec_file_loader.h \
- swfdec_keys.h \
- swfdec_loader.h \
- swfdec_player.h \
- swfdec_player_scripting.h \
- swfdec_rectangle.h \
- swfdec_script.h \
- swfdec_socket.h \
- swfdec_stream.h \
- swfdec_system.h \
- swfdec_url.h
-
-libswfdec_ at SWFDEC_MAJORMINOR@_la_LIBADD = jpeg/libjpeg.la
-libswfdec_ at SWFDEC_MAJORMINOR@includedir = $(includedir)/swfdec- at SWFDEC_MAJORMINOR@/libswfdec
-libswfdec_ at SWFDEC_MAJORMINOR@include_HEADERS = $(public_headers) swfdec_enums.h
-
-noinst_HEADERS = \
- swfdec_as_boolean.h \
- swfdec_as_frame_internal.h \
- swfdec_as_initialize.h \
- swfdec_as_internal.h \
- swfdec_as_date.h \
- swfdec_as_interpret.h \
- swfdec_as_number.h \
- swfdec_as_script_function.h \
- swfdec_as_stack.h \
- swfdec_as_string.h \
- swfdec_as_strings.h \
- swfdec_as_super.h \
- swfdec_asnative.h \
- swfdec_amf.h \
- swfdec_audio_internal.h \
- swfdec_audio_event.h \
- swfdec_audio_flv.h \
- swfdec_audio_stream.h \
- swfdec_bits.h \
- swfdec_button.h \
- swfdec_button_movie.h \
- swfdec_cache.h \
- swfdec_cached.h \
- swfdec_character.h \
- swfdec_codec_audio.h \
- swfdec_codec_video.h \
- swfdec_color.h \
- swfdec_debug.h \
- swfdec_decoder.h \
- swfdec_draw.h \
- swfdec_text_field.h \
- swfdec_text_field_movie.h \
- swfdec_event.h \
- swfdec_filter.h \
- swfdec_flv_decoder.h \
- swfdec_font.h \
- swfdec_function_list.h \
- swfdec_gradient_pattern.h \
- swfdec_graphic.h \
- swfdec_graphic_movie.h \
- swfdec_image.h \
- swfdec_image_decoder.h \
- swfdec_initialize.h \
- swfdec_internal.h \
- swfdec_interval.h \
- swfdec_load_object.h \
- swfdec_loader_internal.h \
- swfdec_marshal.h \
- swfdec_morph_movie.h \
- swfdec_morphshape.h \
- swfdec_movie.h \
- swfdec_movie_clip_loader.h \
- swfdec_net_connection.h \
- swfdec_net_stream.h \
- swfdec_path.h \
- swfdec_pattern.h \
- swfdec_player_internal.h \
- swfdec_policy_file.h \
- swfdec_rect.h \
- swfdec_resource.h \
- swfdec_ringbuffer.h \
- swfdec_sandbox.h \
- swfdec_script_internal.h \
- swfdec_shape.h \
- swfdec_shape_parser.h \
- swfdec_sound.h \
- swfdec_sound_object.h \
- swfdec_sprite.h \
- swfdec_sprite_movie.h \
- swfdec_swf_decoder.h \
- swfdec_stream_target.h \
- swfdec_stroke.h \
- swfdec_style_sheet.h \
- swfdec_tag.h \
- swfdec_text.h \
- swfdec_text_format.h \
- swfdec_types.h \
- swfdec_utils.h \
- swfdec_video.h \
- swfdec_video_movie.h \
- swfdec_xml_node.h \
- swfdec_xml.h \
- swfdec_xml_socket.h
-
-EXTRA_DIST = \
- compiler.c \
- swfdec_as_initialize.as \
- swfdec_initialize.as \
- swfdec_marshal.list
-
-BUILT_SOURCES = \
- swfdec_asnative.h \
- swfdec_as_strings.h \
- swfdec_enums.c \
- swfdec_enums.h \
- swfdec_marshal.c \
- swfdec_marshal.h
-
-CLEANFILES = \
- $(BUILT_SOURCES)
-
-swfdec_asnative.h: $(libswfdec_source_files)
- (cd $(srcdir) \
- && echo "#include \"swfdec_as_types.h\"" \
- && echo "#define SWFDEC_AS_NATIVE(x,y,func) void func (SwfdecAsContext *cx, \\" \
- && echo " SwfdecAsObject *object, guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret);" \
- && echo "#define SWFDEC_AS_CONSTRUCTOR(x,y,func,type) SWFDEC_AS_NATIVE(x,y,func) GType type (void);" \
- && grep -he "^SWFDEC_AS_CONSTRUCTOR" $(libswfdec_source_files) \
- && grep -he "^SWFDEC_AS_NATIVE" $(libswfdec_source_files) \
- && echo "#undef SWFDEC_AS_CONSTRUCTOR" \
- && echo "#undef SWFDEC_AS_NATIVE" \
- && echo "#define SWFDEC_AS_NATIVE(x,y,func) SWFDEC_AS_CONSTRUCTOR(x,y,func,NULL)" \
- && echo "#define SWFDEC_AS_CONSTRUCTOR(x,y,func,type) { x, y, func, G_STRINGIFY (func), type }," \
- && echo "static const struct { guint x, y; SwfdecAsNative func; const char *name; GType (* get_type) (void); } native_funcs[] = {" \
- && grep -he "^SWFDEC_AS_CONSTRUCTOR" $(libswfdec_source_files) \
- && grep -he "^SWFDEC_AS_NATIVE" $(libswfdec_source_files) \
- && echo " { 0, 0, NULL }" \
- && echo "};" \
- && echo "#undef SWFDEC_AS_CONSTRUCTOR" \
- && echo "#undef SWFDEC_AS_NATIVE" \
- ) >> xgen-san \
- && (cmp -s xgen-san swfdec_asnative.h || cp xgen-san swfdec_asnative.h) \
- && rm -f xgen-san
-
-swfdec_marshal.h: swfdec_marshal.list Makefile
- $(GLIB_GENMARSHAL) --prefix=swfdec_marshal $(srcdir)/swfdec_marshal.list --header >> xgen-smh \
- && (cmp -s xgen-smh swfdec_marshal.h || cp xgen-smh swfdec_marshal.h) \
- && rm -f xgen-smh
-
-swfdec_marshal.c: swfdec_marshal.list swfdec_marshal.h Makefile
- (echo "#include \"swfdec_marshal.h\""; \
- $(GLIB_GENMARSHAL) --prefix=swfdec_marshal $(srcdir)/swfdec_marshal.list --body;) >> xgen-smc \
- && cp xgen-smc swfdec_marshal.c \
- && rm -f xgen-smc
-
-swfdec_enums.h: $(public_headers) Makefile
- ( cd $(srcdir) && $(GLIB_MKENUMS) \
- --fhead "#ifndef __SWFDEC_ENUMS_H__\n#define __SWFDEC_ENUMS_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
- --fprod "/* enumerations from \"@filename@\" */\n" \
- --vhead "GType @enum_name at _get_type (void) G_GNUC_CONST;\n#define SWFDEC_TYPE_ at ENUMSHORT@ (@enum_name at _get_type())\n" \
- --ftail "G_END_DECLS\n\n#endif /* __SWFDEC_ENUMS_H__ */" \
- $(public_headers) ) >> xgen-seh \
- && (cmp -s xgen-seh swfdec_enums.h || cp xgen-seh swfdec_enums.h ) \
- && rm -f xgen-seh
-
-swfdec_enums.c: $(public_headers) Makefile
- ( cd $(srcdir) && $(GLIB_MKENUMS) \
- --fhead "#include \"swfdec.h\"\n" \
- --fprod "\n/* enumerations from \"@filename@\" */" \
- --vhead "GType\n at enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G at Type@Value values[] = {" \
- --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
- --vtail " { 0, NULL, NULL }\n };\n etype = g_ at type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n }\n return etype;\n}\n" \
- $(public_headers) ) > xgen-sec \
- && (cmp -s xgen-sec swfdec_enums.c || cp xgen-sec swfdec_enums.c ) \
- && rm -f xgen-sec
-
-swfdec_as_strings.h: swfdec_as_strings.c
- ( cd $(srcdir) && echo "/* This is a generated file. See swfdec_as_strings.c for details. */" \
- && echo "#ifndef _SWFDEC_AS_STRINGS_H_" \
- && echo "#define _SWFDEC_AS_STRINGS_H_" \
- && echo "extern const char swfdec_as_strings[];" \
- && grep " SWFDEC_AS_CONSTANT_STRING" swfdec_as_strings.c \
- | sed "s/.*(\"\(.*\)\").*/\1/" \
- | $(AWK) '{ if ($$0 == "") name = "EMPTY"; else if ($$0 == ",") name = "COMMA"; else if ($$0 == "/") name = "SLASH"; else name = $$0; gsub("[^a-zA-Z0-9\\$$]","_",name); print "#define SWFDEC_AS_STR_" name " &swfdec_as_strings[" x + 1 "]"; x = x + length ($$0) + 2 }' \
- && echo "#endif" ) > xgen-sas \
- && (cmp -s xgen-sas swfdec_as_strings.h || cp xgen-sas swfdec_as_strings.h ) \
- && rm -f xgen-sas
diff --git a/libswfdec/compiler.c b/libswfdec/compiler.c
deleted file mode 100644
index 5593cec..0000000
--- a/libswfdec/compiler.c
+++ /dev/null
@@ -1,92 +0,0 @@
-//gcc -Wall -Werror `pkg-config --libs --cflags libming glib-2.0` compiler.c -o compiler
-
-#include <glib.h>
-#include <ming.h>
-#include <string.h>
-
-/* This is what is used to compile the Actionscript parts of the source to
- * includable C data that can later be executed.
- * Note that this is pretty much a hack until someone writes a proper
- * Actionscript compiler for Swfdec.
- * Also note that the creation of the include-scripts should probably not be
- * autorun, as we don't want to depend on external bugs, only on internal ones.
- */
-static gboolean
-write_data (guint8 *data, gsize len)
-{
- gsize i;
-
- for (i = 0; i < len; i++) {
- switch (i % 16) {
- case 0:
- if (i == 0)
- g_print (" 0x%02X", data[i]);
- else
- g_print (",\n 0x%02X", data[i]);
- break;
- case 4:
- case 8:
- case 12:
- g_print (", 0x%02X", data[i]);
- break;
- default:
- g_print (", 0x%02X", data[i]);
- break;
- }
- }
- g_print ("\n");
- return TRUE;
-}
-
-static char *
-get_name (const char *filename)
-{
- char *end;
-
- end = strrchr (filename, '/');
- if (end)
- filename = end + 1;
- end = strchr (filename, '.');
- if (end)
- return g_strndup (filename, end - filename);
- else
- return g_strdup (filename);
-}
-
-int
-main (int argc, char **argv)
-{
- SWFAction action;
- char *contents;
- GError *error = NULL;
- guint i;
- gsize len;
- byte *data;
-
- if (argc < 2) {
- g_print ("usage: %s FILE ...\n\n", argv[0]);
- return 1;
- }
-
- Ming_init ();
- Ming_setSWFCompression (-1);
-
- g_print ("/* This file is autogenerated, do not edit! */\n\n");
- for (i = 1; i < argc; i++) {
- if (!g_file_get_contents (argv[1], &contents, NULL, &error)) {
- g_printerr ("%s\n", error->message);
- g_error_free (error);
- error = NULL;
- return 1;
- }
- action = newSWFAction (contents);
- data = SWFAction_getByteCode (action, &len);
- contents = get_name (argv[i]);
- g_print ("/* compiled from %s */\n", argv[i]);
- g_print ("static const unsigned char %s[] = {\n", contents);
- g_free (contents);
- write_data (data, len);
- g_print ("};\n\n");
- }
- return 0;
-}
diff --git a/libswfdec/jpeg/.gitignore b/libswfdec/jpeg/.gitignore
deleted file mode 100644
index 5bb735b..0000000
--- a/libswfdec/jpeg/.gitignore
+++ /dev/null
@@ -1,14 +0,0 @@
-*~
-CVS
-.cvsignore
-.deps
-.libs
-
-Makefile
-Makefile.in
-*.o
-*.la
-*.lo
-
-jpeg_test
-jpeg_rgb_test
diff --git a/libswfdec/jpeg/Makefile.am b/libswfdec/jpeg/Makefile.am
deleted file mode 100644
index d6475cc..0000000
--- a/libswfdec/jpeg/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-noinst_LTLIBRARIES = libjpeg.la
-
-libjpeg_la_SOURCES = \
- jpeg.c \
- jpeg_bits.c \
- jpeg_huffman.c \
- jpeg_rgb_decoder.c \
- jpeg_tables.c
-
-noinst_HEADERS = \
- cogcompat.h \
- jpeg.h \
- jpeg_bits.h \
- jpeg_huffman.h \
- jpeg_rgb_decoder.h
-
-libjpeg_la_CFLAGS = $(GLOBAL_CFLAGS) $(GLIB_CFLAGS) $(LIBOIL_CFLAGS) -I$(srcdir)/..
-
diff --git a/libswfdec/jpeg/cogcompat.h b/libswfdec/jpeg/cogcompat.h
deleted file mode 100644
index bf2370f..0000000
--- a/libswfdec/jpeg/cogcompat.h
+++ /dev/null
@@ -1,14 +0,0 @@
-
-#ifndef _COG_COMPAT_H_
-#define _COG_COMPAT_H_
-
-#include <swfdec_debug.h>
-
-#define COG_LOG(...) SWFDEC_LOG(__VA_ARGS__)
-#define COG_DEBUG(...) SWFDEC_DEBUG(__VA_ARGS__)
-#define COG_INFO(...) SWFDEC_INFO(__VA_ARGS__)
-#define COG_WARNING(...) SWFDEC_WARNING(__VA_ARGS__)
-#define COG_ERROR(...) SWFDEC_ERROR(__VA_ARGS__)
-
-#endif
-
diff --git a/libswfdec/jpeg/jpeg.c b/libswfdec/jpeg/jpeg.c
deleted file mode 100644
index 52143dc..0000000
--- a/libswfdec/jpeg/jpeg.c
+++ /dev/null
@@ -1,1126 +0,0 @@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <liboil/liboil.h>
-#include <liboil/liboil-stdint.h>
-#include <cogcompat.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "jpeg.h"
-
-
-extern uint8_t jpeg_standard_tables[];
-extern int jpeg_standard_tables_size;
-
-void jpeg_decoder_define_huffman_tables (JpegDecoder * dec);
-void jpeg_decoder_define_arithmetic_conditioning (JpegDecoder *dec);
-void jpeg_decoder_define_quantization_tables (JpegDecoder *dec);
-void jpeg_decoder_define_restart_interval (JpegDecoder *dec);
-void jpeg_decoder_start_of_frame (JpegDecoder * dec, int marker);
-void jpeg_decoder_start_of_scan (JpegDecoder * dec);
-
-
-/* misc helper function declarations */
-
-static void jpeg_load_standard_huffman_tables (JpegDecoder * dec);
-
-static void jpeg_decoder_verify_header (JpegDecoder *dec);
-static void jpeg_decoder_init_decoder (JpegDecoder *dec);
-
-
-void
-jpeg_decoder_error(JpegDecoder *dec, const char *fmt, ...)
-{
- va_list varargs;
-
- if (dec->error) return;
-
- va_start (varargs, fmt);
-#ifdef HAVE_VASPRINTF
- vasprintf(&dec->error_message, fmt, varargs);
-#else
- dec->error_message = malloc(250);
- vsnprintf(dec->error_message, 250 - 1, fmt, varargs);
- dec->error_message[250 - 1] = 0;
-#endif
- va_end (varargs);
-
- dec->error = TRUE;
-}
-
-#define jpeg_decoder_error(dec, ...) { \
- COG_ERROR("decoder error: "__VA_ARGS__); \
- jpeg_decoder_error (dec, __VA_ARGS__); \
-}
-
-static void
-jpeg_decoder_verify_header (JpegDecoder *dec)
-{
- int max_quant_table = 0;
- int i;
-
- if (dec->sof_type != JPEG_MARKER_SOF_0) {
- COG_ERROR("only handle baseline DCT");
- dec->error = TRUE;
- }
-
- if (dec->width < 1) {
- COG_ERROR("height can't be 0");
- dec->error = TRUE;
- }
-
- switch (dec->sof_type) {
- case JPEG_MARKER_SOF_0:
- /* baseline DCT */
- max_quant_table = 3;
- if (dec->depth != 8) {
- COG_ERROR("depth must be 8 (%d)", dec->depth);
- dec->error = TRUE;
- }
- break;
- case JPEG_MARKER_SOF_1:
- /* extended DCT */
- max_quant_table = 3;
- if (dec->depth != 8 && dec->depth != 12) {
- COG_ERROR("depth must be 8 or 12 (%d)", dec->depth);
- dec->error = TRUE;
- }
- break;
- case JPEG_MARKER_SOF_2:
- /* progressive DCT */
- max_quant_table = 3;
- if (dec->depth != 8 && dec->depth != 12) {
- COG_ERROR("depth must be 8 or 12 (%d)", dec->depth);
- dec->error = TRUE;
- }
- break;
- case JPEG_MARKER_SOF_3:
- /* lossless DCT */
- max_quant_table = 0;
- if (dec->depth < 2 || dec->depth > 16) {
- COG_ERROR("depth must be between 2 and 16 (%d)", dec->depth);
- dec->error = TRUE;
- }
- break;
- default:
- break;
- }
-
- if (dec->n_components < 0 || dec->n_components > 255) {
- COG_ERROR("n_components must be in the range 0-255 (%d)",
- dec->n_components);
- dec->error = TRUE;
- }
- if (dec->sof_type == JPEG_MARKER_SOF_2 && dec->n_components > 4) {
- COG_ERROR("n_components must be <= 4 for progressive DCT (%d)",
- dec->n_components);
- dec->error = TRUE;
- }
-
- for (i = 0; i < dec->n_components; i++) {
- if (dec->components[i].id < 0 || dec->components[i].id > 255) {
- COG_ERROR("component ID out of range");
- dec->error = TRUE;
- break;
- }
- if (dec->components[i].h_sample < 1 || dec->components[i].h_sample > 4 ||
- dec->components[i].v_sample < 1 || dec->components[i].v_sample > 4) {
- COG_ERROR("sample factor(s) for component %d out of range %d %d",
- i, dec->components[i].h_sample, dec->components[i].v_sample);
- dec->error = TRUE;
- break;
- }
- if (dec->components[i].quant_table < 0 ||
- dec->components[i].quant_table > max_quant_table) {
- COG_ERROR("quant table for component %d out of range (%d)",
- i, dec->components[i].quant_table);
- dec->error = TRUE;
- break;
- }
- }
-}
-
-static void
-jpeg_decoder_init_decoder (JpegDecoder *dec)
-{
- int max_h_sample = 0;
- int max_v_sample = 0;
- int i;
-
- /* decoder limitations */
- if (dec->n_components != 3) {
- jpeg_decoder_error(dec, "wrong number of components %d", dec->n_components);
- return;
- }
- if (dec->sof_type != JPEG_MARKER_SOF_0) {
- jpeg_decoder_error(dec, "only handle baseline DCT");
- return;
- }
-
-
-
-
- for (i=0; i < dec->n_components; i++) {
- max_h_sample = MAX (max_h_sample, dec->components[i].h_sample);
- max_v_sample = MAX (max_v_sample, dec->components[i].v_sample);
- }
-
- dec->width_blocks =
- (dec->width + 8 * max_h_sample - 1) / (8 * max_h_sample);
- dec->height_blocks =
- (dec->height + 8 * max_v_sample - 1) / (8 * max_v_sample);
- for (i = 0; i < dec->n_components; i++) {
- int rowstride;
- int image_size;
-
- dec->components[i].h_subsample = max_h_sample /
- dec->components[i].h_sample;
- dec->components[i].v_subsample = max_v_sample /
- dec->components[i].v_sample;
-
- rowstride = dec->width_blocks * 8 * max_h_sample /
- dec->components[i].h_subsample;
- image_size = rowstride *
- (dec->height_blocks * 8 * max_v_sample /
- dec->components[i].v_subsample);
- dec->components[i].rowstride = rowstride;
- dec->components[i].image = malloc (image_size);
- }
-}
-
-#if 0
-static char *
-sprintbits (char *str, unsigned int bits, int n)
-{
- int i;
- int bit = 1 << (n - 1);
-
- for (i = 0; i < n; i++) {
- str[i] = (bits & bit) ? '1' : '0';
- bit >>= 1;
- }
- str[i] = 0;
-
- return str;
-}
-
-static void
-generate_code_table (int *huffsize)
-{
- int code;
- int i;
- int j;
- int k;
- char str[33];
-
- //int l;
-
- code = 0;
- k = 0;
- for (i = 0; i < 16; i++) {
- for (j = 0; j < huffsize[i]; j++) {
- COG_DEBUG ("huffcode[%d] = %s", k,
- sprintbits (str, code >> (15 - i), i + 1));
- code++;
- k++;
- }
- code <<= 1;
- }
-
-}
-#endif
-
-static int
-huffman_table_init_jpeg (JpegDecoder *decoder, HuffmanTable *table, JpegBits * bits)
-{
- int n_symbols;
- int huffsize[16];
- int i, j, k;
- unsigned int symbol;
- int n = 0;
-
- huffman_table_init (table);
-
- /* huffsize[i] is the number of symbols that have length
- * (i+1) bits. Maximum bit length is 16 bits, so there are
- * 16 entries. */
- n_symbols = 0;
- for (i = 0; i < 16; i++) {
- huffsize[i] = jpeg_bits_get_u8 (bits);
- n++;
- n_symbols += huffsize[i];
- }
-
- /* Build up the symbol table. The first symbol is all 0's, with
- * the number of bits determined by the first non-zero entry in
- * huffsize[]. Subsequent symbols with the same bit length are
- * incremented by 1. Increasing the bit length shifts the
- * symbol 1 bit to the left. */
- symbol = 0;
- k = 0;
- for (i = 0; i < 16; i++) {
- for (j = 0; j < huffsize[i]; j++) {
- huffman_table_add (table, symbol, i + 1, jpeg_bits_get_u8 (bits));
- n++;
- symbol++;
- k++;
- }
- /* This checks that our symbol is actually less than the
- * number of bits we think it is. This is only triggered
- * for bad huffsize[] arrays. */
- if (symbol >= (1U << (i + 1))) {
- jpeg_decoder_error (decoder, "bad huffsize[] array");
- return -1;
- }
-
- symbol <<= 1;
- }
-
- huffman_table_dump (table);
-
- return n;
-}
-
-static int
-jpeg_decoder_find_component_by_id (JpegDecoder * dec, int id)
-{
- int i;
-
- for (i = 0; i < dec->n_components; i++) {
- if (dec->components[i].id == id)
- return i;
- }
- COG_DEBUG ("undefined component id %d", id);
- return 0;
-}
-
-int
-jpeg_decoder_application0 (JpegDecoder * dec, JpegBits * bits)
-{
- int length;
-
- COG_DEBUG ("app0");
-
- length = get_be_u16 (bits);
- COG_DEBUG ("length=%d", length);
-
- if (memcmp (bits->ptr, "JFIF", 4) == 0 && bits->ptr[4] == 0) {
- int version;
- int units;
- int x_density;
- int y_density;
- int x_thumbnail;
- int y_thumbnail;
-
- COG_DEBUG ("JFIF");
- bits->ptr += 5;
-
- version = get_be_u16 (bits);
- units = get_u8 (bits);
- x_density = get_be_u16 (bits);
- y_density = get_be_u16 (bits);
- x_thumbnail = get_u8 (bits);
- y_thumbnail = get_u8 (bits);
-
- COG_DEBUG ("version = %04x", version);
- COG_DEBUG ("units = %d", units);
- COG_DEBUG ("x_density = %d", x_density);
- COG_DEBUG ("y_density = %d", y_density);
- COG_DEBUG ("x_thumbnail = %d", x_thumbnail);
- COG_DEBUG ("y_thumbnail = %d", y_thumbnail);
-
- }
-
- if (memcmp (bits->ptr, "JFXX", 4) == 0 && bits->ptr[4] == 0) {
- COG_DEBUG ("JFIF extension (not handled)");
- bits->ptr += length - 2;
- }
-
- return length;
-}
-
-int
-jpeg_decoder_application_misc (JpegDecoder * dec, JpegBits * bits)
-{
- int length;
-
- COG_DEBUG ("appX");
-
- length = get_be_u16 (bits);
- COG_DEBUG ("length=%d", length);
-
- COG_DEBUG ("JPEG application tag X ignored");
- //dumpbits (bits);
-
- bits->ptr += length - 2;
-
- return length;
-}
-
-int
-jpeg_decoder_comment (JpegDecoder * dec, JpegBits * bits)
-{
- int length;
-
- COG_DEBUG ("comment");
-
- length = get_be_u16 (bits);
- COG_DEBUG ("length=%d", length);
-
- //dumpbits (bits);
-
- bits->ptr += length - 2;
-
- return length;
-}
-
-int
-jpeg_decoder_restart_interval (JpegDecoder * dec, JpegBits * bits)
-{
- int length;
-
- COG_DEBUG ("comment");
-
- length = get_be_u16 (bits);
- COG_DEBUG ("length=%d", length);
-
- dec->restart_interval = get_be_u16 (bits);
- COG_DEBUG ("restart_interval=%d", dec->restart_interval);
-
- return length;
-}
-
-int
-jpeg_decoder_restart (JpegDecoder * dec, JpegBits * bits)
-{
- COG_DEBUG ("restart");
-
- return 0;
-}
-
-void
-jpeg_decoder_decode_entropy_segment (JpegDecoder * dec)
-{
- JpegBits * bits = &dec->bits;
- JpegBits b2, *bits2 = &b2;
- short block[64];
- short block2[64];
- unsigned char *newptr;
- int len;
- int maxlen;
- int j;
- int i;
- int go;
- int x, y;
- int n;
- int ret;
-
- len = 0;
- maxlen = jpeg_bits_available (bits) - 1;
- j = 0;
- while (len < maxlen) {
- if (bits->ptr[len] == 0xff && bits->ptr[len + 1] != 0x00) {
- break;
- }
- len++;
- }
- COG_DEBUG ("entropy length = %d", len);
-
- /* we allocate extra space, since the getbits() code can
- * potentially read past the end of the buffer */
- newptr = malloc (len + 2);
- for (i = 0; i < len; i++) {
- newptr[j] = bits->ptr[i];
- j++;
- if (bits->ptr[i] == 0xff)
- i++;
- }
- bits->ptr += len;
-
- bits2->ptr = newptr;
- bits2->idx = 0;
- bits2->end = newptr + j;
- newptr[j] = 0;
- newptr[j + 1] = 0;
-
- dec->dc[0] = dec->dc[1] = dec->dc[2] = dec->dc[3] = 128 * 8;
- go = 1;
- x = dec->x;
- y = dec->y;
- n = dec->restart_interval;
- if (n == 0) n = (1<<26); /* max number of blocks */
- while (go && n-- > 0) {
- for (i = 0; i < dec->scan_list_length; i++) {
- int dc_table_index;
- int ac_table_index;
- int quant_index;
- unsigned char *ptr;
- int component_index;
-
- COG_DEBUG ("%d,%d: component=%d dc_table=%d ac_table=%d",
- x, y,
- dec->scan_list[i].component_index,
- dec->scan_list[i].dc_table, dec->scan_list[i].ac_table);
-
- component_index = dec->scan_list[i].component_index;
- dc_table_index = dec->scan_list[i].dc_table;
- ac_table_index = dec->scan_list[i].ac_table;
- quant_index = dec->scan_list[i].quant_table;
-
- ret = huffman_table_decode_macroblock (dec, block,
- &dec->dc_huff_table[dc_table_index],
- &dec->ac_huff_table[ac_table_index], bits2);
- if (ret < 0) {
- COG_DEBUG ("%d,%d: component=%d dc_table=%d ac_table=%d",
- x, y,
- dec->scan_list[i].component_index,
- dec->scan_list[i].dc_table, dec->scan_list[i].ac_table);
- n = 0;
- break;
- }
-
- COG_DEBUG ("using quant table %d", quant_index);
- oil_mult8x8_s16 (block2, block, dec->quant_tables[quant_index].quantizer,
- sizeof (short) * 8, sizeof(short) * 8, sizeof (short) * 8);
- dec->dc[component_index] += block2[0];
- block2[0] = dec->dc[component_index];
- oil_unzigzag8x8_s16 (block, sizeof (short) * 8, block2,
- sizeof (short) * 8);
- oil_idct8x8_s16 (block2, sizeof (short) * 8, block, sizeof (short) * 8);
- oil_trans8x8_s16 (block, sizeof (short) * 8, block2, sizeof (short) * 8);
-
- ptr = dec->components[component_index].image +
- x * dec->components[component_index].h_sample +
- dec->scan_list[i].offset +
- dec->components[component_index].rowstride * y *
- dec->components[component_index].v_sample;
-
- oil_clipconv8x8_u8_s16 (ptr,
- dec->components[component_index].rowstride,
- block, sizeof (short) * 8);
- }
- x += 8;
- if (x * dec->scan_h_subsample >= dec->width) {
- x = 0;
- y += 8;
- }
- if (y * dec->scan_v_subsample >= dec->height) {
- go = 0;
- }
- }
- dec->x = x;
- dec->y = y;
- free (newptr);
-}
-
-
-
-JpegDecoder *
-jpeg_decoder_new (void)
-{
- JpegDecoder *dec;
-
- oil_init ();
-
- dec = malloc (sizeof(JpegDecoder));
- memset (dec, 0, sizeof(JpegDecoder));
-
- jpeg_load_standard_huffman_tables (dec);
-
- return dec;
-}
-
-void
-jpeg_decoder_free (JpegDecoder * dec)
-{
- int i;
-
- for (i = 0; i < JPEG_LIMIT_COMPONENTS; i++) {
- if (dec->components[i].image)
- free (dec->components[i].image);
- }
-
- if (dec->data)
- free (dec->data);
-
- free (dec);
-}
-
-static int
-jpeg_decoder_get_marker (JpegDecoder *dec, int *marker)
-{
- int a,b;
- JpegBits *bits = &dec->bits;
-
- if (jpeg_bits_available(bits) < 2) {
- return FALSE;
- }
-
- a = jpeg_bits_get_u8(bits);
- if (a != 0xff) {
- jpeg_decoder_error(dec, "expected marker, not 0x%02x", a);
- return FALSE;
- }
-
- do {
- b = jpeg_bits_get_u8 (bits);
- } while (b == 0xff && jpeg_bits_error(bits));
-
- *marker = b;
- return TRUE;
-}
-
-static void
-jpeg_decoder_skip (JpegDecoder *dec)
-{
- int length;
-
- length = jpeg_bits_get_u16_be (&dec->bits);
- jpeg_bits_skip (&dec->bits, length - 2);
-}
-
-int
-jpeg_decoder_decode (JpegDecoder *dec)
-{
- JpegBits *bits;
- int marker;
-
- dec->error = FALSE;
-
- bits = &dec->bits;
-
- /* Note: The spec is ambiguous as to whether fill bytes can come
- * before the first marker. We'll assume yes. */
- if (!jpeg_decoder_get_marker (dec, &marker)) {
- return FALSE;
- }
- if (dec->strict && marker != JPEG_MARKER_SOI) {
- jpeg_decoder_error(dec, "not a JPEG image");
- return FALSE;
- }
-
- /* Interpret markers up to the start of frame */
- while (!dec->error) {
- if (!jpeg_decoder_get_marker (dec, &marker)) {
- return FALSE;
- }
-
- if (marker == JPEG_MARKER_DEFINE_HUFFMAN_TABLES) {
- jpeg_decoder_define_huffman_tables (dec);
- } else if (marker == JPEG_MARKER_DEFINE_ARITHMETIC_CONDITIONING) {
- jpeg_decoder_define_arithmetic_conditioning (dec);
- } else if (marker == JPEG_MARKER_DEFINE_QUANTIZATION_TABLES) {
- jpeg_decoder_define_quantization_tables (dec);
- } else if (marker == JPEG_MARKER_DEFINE_RESTART_INTERVAL) {
- jpeg_decoder_define_restart_interval (dec);
- } else if (JPEG_MARKER_IS_APP(marker)) {
- /* FIXME decode app segment */
- jpeg_decoder_skip (dec);
- } else if (marker == JPEG_MARKER_COMMENT) {
- jpeg_decoder_skip (dec);
- } else if (JPEG_MARKER_IS_START_OF_FRAME(marker)) {
- break;
- } else if (marker == JPEG_MARKER_SOI) {
- if (dec->strict) {
- jpeg_decoder_error (dec, "unexpected SOI");
- return FALSE;
- }
- } else if (marker == JPEG_MARKER_EOI) {
- if (dec->strict) {
- jpeg_decoder_error (dec, "unexpected EOI");
- return FALSE;
- }
- } else {
- jpeg_decoder_error(dec, "unexpected marker 0x%02x", marker);
- return FALSE;
- }
- }
- if (dec->error) {
- return FALSE;
- }
-
- jpeg_decoder_start_of_frame(dec, marker);
-
- jpeg_decoder_verify_header (dec);
- if (dec->error) {
- return FALSE;
- }
-
- jpeg_decoder_init_decoder (dec);
- if (dec->error) {
- return FALSE;
- }
-
- /* In this section, we loop over parse units until we reach the end
- * of the image. */
- while (!dec->error) {
- if (!jpeg_decoder_get_marker (dec, &marker)) {
- return FALSE;
- }
-
- if (marker == JPEG_MARKER_DEFINE_HUFFMAN_TABLES) {
- jpeg_decoder_define_huffman_tables (dec);
- } else if (marker == JPEG_MARKER_DEFINE_ARITHMETIC_CONDITIONING) {
- jpeg_decoder_define_arithmetic_conditioning (dec);
- } else if (marker == JPEG_MARKER_DEFINE_QUANTIZATION_TABLES) {
- jpeg_decoder_define_quantization_tables (dec);
- } else if (marker == JPEG_MARKER_DEFINE_RESTART_INTERVAL) {
- jpeg_decoder_define_restart_interval (dec);
- } else if (JPEG_MARKER_IS_APP(marker)) {
- jpeg_decoder_skip (dec);
- } else if (marker == JPEG_MARKER_COMMENT) {
- jpeg_decoder_skip (dec);
- } else if (marker == JPEG_MARKER_SOS) {
- jpeg_decoder_start_of_scan (dec);
- if (dec->error) {
- return FALSE;
- }
- jpeg_decoder_decode_entropy_segment (dec);
- } else if (JPEG_MARKER_IS_RESET(marker)) {
- jpeg_decoder_decode_entropy_segment (dec);
- } else if (marker == JPEG_MARKER_SOI) {
- if (dec->strict) {
- jpeg_decoder_error (dec, "unexpected SOI");
- return FALSE;
- }
- } else if (marker == JPEG_MARKER_EOI) {
- if (dec->strict) {
- jpeg_decoder_error (dec, "unexpected EOI");
- return FALSE;
- } else {
- break;
- }
- } else {
- jpeg_decoder_error(dec, "unexpected marker 0x%02x", marker);
- return FALSE;
- }
- }
- if (dec->error) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* handle markers */
-
-void
-jpeg_decoder_define_huffman_tables (JpegDecoder * dec)
-{
- JpegBits *bits = &dec->bits;
- int length;
- int tc;
- int th;
- int x;
- HuffmanTable *hufftab;
-
- COG_DEBUG ("define huffman tables");
-
- length = jpeg_bits_get_u16_be (bits);
- if (length < 2) {
- jpeg_decoder_error(dec, "length too short");
- return;
- }
- length -= 2;
-
- while (length > 0) {
- x = jpeg_bits_get_u8 (bits);
- length--;
-
- tc = x >> 4;
- th = x & 0xf;
-
- COG_DEBUG ("huff table type %d (%s) idx %d", tc, tc ? "ac" : "dc", th);
- if (tc > 1 || th > 3) {
- jpeg_decoder_error(dec, "huffman table type or idx out of range");
- return;
- }
-
- if (tc) {
- hufftab = &dec->ac_huff_table[th];
- length -= huffman_table_init_jpeg (dec, hufftab, bits);
- } else {
- hufftab = &dec->dc_huff_table[th];
- length -= huffman_table_init_jpeg (dec, hufftab, bits);
- }
- if (dec->error) {
- return;
- }
- }
- if (length < 0) {
- jpeg_decoder_error(dec, "huffman table overran available bytes");
- return;
- }
-}
-
-void
-jpeg_decoder_define_quantization_tables (JpegDecoder *dec)
-{
- JpegBits *bits = &dec->bits;
- JpegQuantTable *table;
- int length;
- int pq;
- int tq;
- int i;
-
- COG_INFO ("define quantization table");
-
- length = jpeg_bits_get_u16_be (bits);
- if (length < 2) {
- jpeg_decoder_error(dec, "length too short");
- return;
- }
- length -= 2;
-
- while (length > 0) {
- int x;
-
- x = jpeg_bits_get_u8 (bits);
- length--;
- pq = x >> 4;
- tq = x & 0xf;
-
- if (pq > 1) {
- jpeg_decoder_error (dec, "bad pq value");
- return;
- }
- if (tq > 3) {
- jpeg_decoder_error (dec, "bad tq value");
- return;
- }
-
- table = &dec->quant_tables[tq];
- if (pq) {
- for (i = 0; i < 64; i++) {
- table->quantizer[i] = jpeg_bits_get_u16_be (bits);
- length -= 2;
- }
- } else {
- for (i = 0; i < 64; i++) {
- table->quantizer[i] = jpeg_bits_get_u8 (bits);
- length -= 1;
- }
- }
- }
- if (length < 0) {
- jpeg_decoder_error(dec, "quantization table overran available bytes");
- return;
- }
-}
-
-void
-jpeg_decoder_define_restart_interval (JpegDecoder *dec)
-{
- JpegBits *bits = &dec->bits;
- int length;
-
- length = jpeg_bits_get_u16_be (bits);
- if (length != 4) {
- jpeg_decoder_error(dec, "length supposed to be 4 (%d)", length);
- return;
- }
-
- /* FIXME this needs to be checked somewhere */
- dec->restart_interval = jpeg_bits_get_u16_be (bits);
-}
-
-void
-jpeg_decoder_define_arithmetic_conditioning (JpegDecoder *dec)
-{
- /* we don't handle arithmetic coding, so skip it */
- jpeg_decoder_skip (dec);
-}
-
-void
-jpeg_decoder_start_of_frame (JpegDecoder * dec, int marker)
-{
- JpegBits *bits = &dec->bits;
- int i;
- int length;
-
- COG_INFO ("start of frame");
-
- dec->sof_type = marker;
-
- length = jpeg_bits_get_u16_be (bits);
-
- if (jpeg_bits_available(bits) < length) {
- jpeg_decoder_error(dec, "not enough data for start_of_frame (%d < %d)",
- length, jpeg_bits_available(bits));
- return;
- }
-
- dec->depth = jpeg_bits_get_u8 (bits);
- dec->height = jpeg_bits_get_u16_be (bits);
- dec->width = jpeg_bits_get_u16_be (bits);
- dec->n_components = jpeg_bits_get_u8 (bits);
-
- COG_DEBUG (
- "frame_length=%d depth=%d height=%d width=%d n_components=%d", length,
- dec->depth, dec->height, dec->width, dec->n_components);
-
- if (dec->n_components * 3 + 8 != length) {
- jpeg_decoder_error(dec, "inconsistent header");
- return;
- }
-
- for (i = 0; i < dec->n_components; i++) {
- dec->components[i].id = get_u8 (bits);
- dec->components[i].h_sample = getbits (bits, 4);
- dec->components[i].v_sample = getbits (bits, 4);
- dec->components[i].quant_table = get_u8 (bits);
-
- COG_DEBUG (
- "[%d] id=%d h_sample=%d v_sample=%d quant_table=%d", i,
- dec->components[i].id, dec->components[i].h_sample,
- dec->components[i].v_sample, dec->components[i].quant_table);
- }
-}
-
-void
-jpeg_decoder_start_of_scan (JpegDecoder * dec)
-{
- JpegBits *bits = &dec->bits;
- int length;
- int i;
- int spectral_start;
- int spectral_end;
- int approx_high;
- int approx_low;
- int n;
- int tmp;
- int n_components;
-
- COG_DEBUG ("start of scan");
-
- length = jpeg_bits_get_u16_be (bits);
- COG_DEBUG ("length=%d", length);
-
- n_components = jpeg_bits_get_u8 (bits);
- n = 0;
- dec->scan_h_subsample = 0;
- dec->scan_v_subsample = 0;
- for (i = 0; i < n_components; i++) {
- int component_id;
- int dc_table;
- int ac_table;
- int x;
- int y;
- int idx;
- int h_subsample;
- int v_subsample;
- int quant_index;
-
- component_id = jpeg_bits_get_u8 (bits);
- tmp = jpeg_bits_get_u8 (bits);
- dc_table = tmp >> 4;
- ac_table = tmp & 0xf;
- idx = jpeg_decoder_find_component_by_id (dec, component_id);
-
- h_subsample = dec->components[idx].h_sample;
- v_subsample = dec->components[idx].v_sample;
- quant_index = dec->components[idx].quant_table;
-
- for (y = 0; y < v_subsample; y++) {
- for (x = 0; x < h_subsample; x++) {
- dec->scan_list[n].component_index = idx;
- dec->scan_list[n].dc_table = dc_table;
- dec->scan_list[n].ac_table = ac_table;
- dec->scan_list[n].quant_table = quant_index;
- dec->scan_list[n].x = x;
- dec->scan_list[n].y = y;
- dec->scan_list[n].offset =
- y * 8 * dec->components[idx].rowstride + x * 8;
- n++;
- if (n > JPEG_LIMIT_SCAN_LIST_LENGTH) {
- jpeg_decoder_error(dec, "scan list too long");
- return;
- }
- }
- }
-
- dec->scan_h_subsample = MAX (dec->scan_h_subsample, h_subsample);
- dec->scan_v_subsample = MAX (dec->scan_v_subsample, v_subsample);
-
- COG_DEBUG ("component %d: idx=%d dc_table=%d ac_table=%d n=%d",
- component_id, idx, dc_table, ac_table, n);
- }
- dec->scan_list_length = n;
-
-
- spectral_start = jpeg_bits_get_u8 (bits);
- spectral_end = jpeg_bits_get_u8 (bits);
- COG_DEBUG ("spectral range [%d,%d]", spectral_start, spectral_end);
- tmp = jpeg_bits_get_u8 (bits);
- approx_high = tmp >> 4;
- approx_low = tmp & 0xf;
- COG_DEBUG ("approx range [%d,%d]", approx_low, approx_high);
-
- dec->x = 0;
- dec->y = 0;
- dec->dc[0] = dec->dc[1] = dec->dc[2] = dec->dc[3] = 128 * 8;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-int
-jpeg_decoder_addbits (JpegDecoder * dec, unsigned char *data, unsigned int len)
-{
- unsigned int offset;
-
- offset = dec->bits.ptr - dec->data;
-
- dec->data = realloc (dec->data, dec->data_len + len);
- memcpy (dec->data + dec->data_len, data, len);
- dec->data_len += len;
-
- dec->bits.ptr = dec->data + offset;
- dec->bits.end = dec->data + dec->data_len;
-
- return 0;
-}
-
-int
-jpeg_decoder_get_image_size (JpegDecoder * dec, int *width, int *height)
-{
- if (width)
- *width = dec->width;
- if (height)
- *height = dec->height;
-
- return 0;
-}
-
-int
-jpeg_decoder_get_component_ptr (JpegDecoder * dec, int id,
- unsigned char **image, int *rowstride)
-{
- int i;
-
- i = jpeg_decoder_find_component_by_id (dec, id);
- if (image)
- *image = dec->components[i].image;
- if (rowstride)
- *rowstride = dec->components[i].rowstride;
-
- return 0;
-}
-
-int
-jpeg_decoder_get_component_size (JpegDecoder * dec, int id,
- int *width, int *height)
-{
- int i;
-
- /* subsampling sizes are rounded up */
-
- i = jpeg_decoder_find_component_by_id (dec, id);
- if (width)
- *width = (dec->width - 1) / dec->components[i].h_subsample + 1;
- if (height)
- *height = (dec->height - 1) / dec->components[i].v_subsample + 1;
-
- return 0;
-}
-
-int
-jpeg_decoder_get_component_subsampling (JpegDecoder * dec, int id,
- int *h_subsample, int *v_subsample)
-{
- int i;
-
- i = jpeg_decoder_find_component_by_id (dec, id);
- if (h_subsample)
- *h_subsample = dec->components[i].h_subsample;
- if (v_subsample)
- *v_subsample = dec->components[i].v_subsample;
-
- return 0;
-}
-
-#if 0
-int
-jpeg_decoder_parse (JpegDecoder * dec)
-{
- JpegBits *bits = &dec->bits;
- JpegBits b2;
- unsigned int x;
- unsigned int tag;
- int i;
-
- while (bits->ptr < bits->end) {
- x = get_u8 (bits);
- if (x != 0xff) {
- int n = 0;
-
- while (x != 0xff) {
- x = get_u8 (bits);
- n++;
- }
- OIL_DEBUG ("lost sync, skipped %d bytes", n);
- }
- while (x == 0xff) {
- x = get_u8 (bits);
- }
- tag = x;
- OIL_DEBUG ("tag %02x", tag);
-
- b2 = *bits;
-
- for (i = 0; i < n_jpeg_markers - 1; i++) {
- if (tag == jpeg_markers[i].tag) {
- break;
- }
- }
- OIL_DEBUG ("tag: %s", jpeg_markers[i].name);
- if (jpeg_markers[i].func) {
- jpeg_markers[i].func (dec, &b2);
- } else {
- OIL_DEBUG ("unhandled or illegal JPEG marker (0x%02x)", tag);
- dumpbits (&b2);
- }
- if (jpeg_markers[i].flags & JPEG_ENTROPY_SEGMENT) {
- jpeg_decoder_decode_entropy_segment (dec, &b2);
- }
- syncbits (&b2);
- bits->ptr = b2.ptr;
- }
-
- return 0;
-}
-#endif
-
-
-/* misc helper functins */
-
-static void
-jpeg_load_standard_huffman_tables (JpegDecoder * dec)
-{
- JpegBits b, *bits = &b;
-
- bits->ptr = jpeg_standard_tables;
- bits->idx = 0;
- bits->end = jpeg_standard_tables + jpeg_standard_tables_size;
-
- huffman_table_init_jpeg (dec, &dec->dc_huff_table[0], bits);
- huffman_table_init_jpeg (dec, &dec->ac_huff_table[0], bits);
- huffman_table_init_jpeg (dec, &dec->dc_huff_table[1], bits);
- huffman_table_init_jpeg (dec, &dec->ac_huff_table[1], bits);
-}
-
-
-
diff --git a/libswfdec/jpeg/jpeg.h b/libswfdec/jpeg/jpeg.h
deleted file mode 100644
index 6c0ba41..0000000
--- a/libswfdec/jpeg/jpeg.h
+++ /dev/null
@@ -1,190 +0,0 @@
-
-#ifndef _JPEG_DECODER_H_
-#define _JPEG_DECODER_H_
-
-#include <jpeg/jpeg_bits.h>
-
-#include <stdint.h>
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#define JPEG_LIMIT_COMPONENTS 256
-#define JPEG_LIMIT_SCAN_LIST_LENGTH 10
-
-
-typedef struct _JpegDecoder JpegDecoder;
-typedef struct _JpegQuantTable JpegQuantTable;
-typedef struct _HuffmanEntry HuffmanEntry;
-typedef struct _HuffmanTable HuffmanTable;
-
-struct _HuffmanEntry {
- unsigned int symbol;
- unsigned int mask;
- int n_bits;
- unsigned char value;
-};
-
-struct _HuffmanTable {
- int len;
- HuffmanEntry entries[256];
-};
-
-struct _JpegQuantTable {
- int pq;
- int16_t quantizer[64];
-};
-
-struct _JpegDecoder {
- int width;
- int height;
- int depth;
- int n_components;
- JpegBits bits;
- int error;
- int strict;
- char *error_message;
-
- int sof_type;
-
- int width_blocks;
- int height_blocks;
-
- int restart_interval;
-
- unsigned char *data;
- unsigned int data_len;
-
- struct{
- int id;
- int h_sample;
- int v_sample;
- int quant_table;
-
- int h_subsample;
- int v_subsample;
- unsigned char *image;
- int rowstride;
- } components[JPEG_LIMIT_COMPONENTS];
-
- JpegQuantTable quant_tables[4];
- HuffmanTable dc_huff_table[4];
- HuffmanTable ac_huff_table[4];
-
- int scan_list_length;
- struct{
- int component_index;
- int dc_table;
- int ac_table;
- int quant_table;
- int x;
- int y;
- int offset;
- }scan_list[JPEG_LIMIT_SCAN_LIST_LENGTH];
- int scan_h_subsample;
- int scan_v_subsample;
-
- /* scan state */
- int x,y;
- int dc[4];
-};
-
-#define JPEG_MARKER_STUFFED 0x00
-#define JPEG_MARKER_TEM 0x01
-#define JPEG_MARKER_RES 0x02
-
-#define JPEG_MARKER_SOF_0 0xc0
-#define JPEG_MARKER_SOF_1 0xc1
-#define JPEG_MARKER_SOF_2 0xc2
-#define JPEG_MARKER_SOF_3 0xc3
-#define JPEG_MARKER_DEFINE_HUFFMAN_TABLES 0xc4
-#define JPEG_MARKER_SOF_5 0xc5
-#define JPEG_MARKER_SOF_6 0xc6
-#define JPEG_MARKER_SOF_7 0xc7
-#define JPEG_MARKER_JPG 0xc8
-#define JPEG_MARKER_SOF_9 0xc9
-#define JPEG_MARKER_SOF_10 0xca
-#define JPEG_MARKER_SOF_11 0xcb
-#define JPEG_MARKER_DEFINE_ARITHMETIC_CONDITIONING 0xcc
-#define JPEG_MARKER_SOF_13 0xcd
-#define JPEG_MARKER_SOF_14 0xce
-#define JPEG_MARKER_SOF_15 0xcf
-
-#define JPEG_MARKER_RST_0 0xd0
-#define JPEG_MARKER_RST_1 0xd1
-#define JPEG_MARKER_RST_2 0xd2
-#define JPEG_MARKER_RST_3 0xd3
-#define JPEG_MARKER_RST_4 0xd4
-#define JPEG_MARKER_RST_5 0xd5
-#define JPEG_MARKER_RST_6 0xd6
-#define JPEG_MARKER_RST_7 0xd7
-
-#define JPEG_MARKER_SOI 0xd8
-#define JPEG_MARKER_EOI 0xd9
-#define JPEG_MARKER_SOS 0xda
-#define JPEG_MARKER_DEFINE_QUANTIZATION_TABLES 0xdb
-#define JPEG_MARKER_DNL 0xdc
-#define JPEG_MARKER_DEFINE_RESTART_INTERVAL 0xdd
-#define JPEG_MARKER_DHP 0xde
-#define JPEG_MARKER_EXP 0xdf
-#define JPEG_MARKER_APP(x) (0xe0 + (x))
-#define JPEG_MARKER_JPG_(x) (0xf0 + (x))
-#define JPEG_MARKER_COMMENT 0xfe
-
-#define JPEG_MARKER_JFIF JPEG_MARKER_APP(0)
-
-#define JPEG_MARKER_IS_START_OF_FRAME(x) ((x)>=0xc0 && (x) <= 0xcf && (x)!=0xc4 && (x)!=0xc8 && (x)!=0xcc)
-#define JPEG_MARKER_IS_APP(x) ((x)>=0xe0 && (x) <= 0xef)
-#define JPEG_MARKER_IS_RESET(x) ((x)>=0xd0 && (x)<=0xd7)
-
-
-
-JpegDecoder *jpeg_decoder_new(void);
-void jpeg_decoder_free(JpegDecoder *dec);
-int jpeg_decoder_addbits(JpegDecoder *dec, unsigned char *data, unsigned int len);
-int jpeg_decoder_decode (JpegDecoder *dec);
-int jpeg_decoder_get_image_size(JpegDecoder *dec, int *width, int *height);
-int jpeg_decoder_get_component_size(JpegDecoder *dec, int id,
- int *width, int *height);
-int jpeg_decoder_get_component_subsampling(JpegDecoder *dec, int id,
- int *h_subsample, int *v_subsample);
-int jpeg_decoder_get_component_ptr(JpegDecoder *dec, int id,
- unsigned char **image, int *rowstride);
-
-uint32_t *jpeg_decoder_get_argb_image (JpegDecoder *dec);
-int jpeg_decode_argb (uint8_t *data, int length, uint32_t **image,
- int *width, int *height);
-
-void jpeg_decoder_error(JpegDecoder *dec, const char *fmt, ...);
-
-int jpeg_decoder_sof_baseline_dct(JpegDecoder *dec, JpegBits *bits);
-int jpeg_decoder_define_quant_table(JpegDecoder *dec, JpegBits *bits);
-int jpeg_decoder_define_huffman_table(JpegDecoder *dec, JpegBits *bits);
-int jpeg_decoder_sos(JpegDecoder *dec, JpegBits *bits);
-int jpeg_decoder_soi(JpegDecoder *dec, JpegBits *bits);
-int jpeg_decoder_eoi(JpegDecoder *dec, JpegBits *bits);
-int jpeg_decoder_application0(JpegDecoder *dec, JpegBits *bits);
-int jpeg_decoder_application_misc(JpegDecoder *dec, JpegBits *bits);
-int jpeg_decoder_comment(JpegDecoder *dec, JpegBits *bits);
-int jpeg_decoder_restart_interval(JpegDecoder *dec, JpegBits *bits);
-int jpeg_decoder_restart(JpegDecoder *dec, JpegBits *bits);
-void jpeg_decoder_decode_entropy_segment(JpegDecoder *dec);
-
-
-void huffman_table_init(HuffmanTable *table);
-
-void huffman_table_dump(HuffmanTable *table);
-void huffman_table_add(HuffmanTable *table, uint32_t code, int n_bits,
- int value);
-unsigned int huffman_table_decode_jpeg(JpegDecoder *dec, HuffmanTable *tab, JpegBits *bits);
-int huffman_table_decode_macroblock(JpegDecoder *dec, short *block, HuffmanTable *dc_tab,
- HuffmanTable *ac_tab, JpegBits *bits);
-int huffman_table_decode(JpegDecoder *dec, HuffmanTable *dc_tab, HuffmanTable *ac_tab, JpegBits *bits);
-
-
-#endif
-
diff --git a/libswfdec/jpeg/jpeg_bits.c b/libswfdec/jpeg/jpeg_bits.c
deleted file mode 100644
index 87700e9..0000000
--- a/libswfdec/jpeg/jpeg_bits.c
+++ /dev/null
@@ -1,154 +0,0 @@
-
-#include <stdio.h>
-
-#include "jpeg_bits.h"
-
-/* FIXME */
-#define TRUE 1
-#define FALSE 0
-
-int jpeg_bits_error (JpegBits *bits)
-{
- return bits->error;
-}
-
-int jpeg_bits_get_u8 (JpegBits *bits)
-{
- if (bits->ptr < bits->end) {
- return *bits->ptr++;
- }
- bits->error = TRUE;
- return 0;
-}
-
-void jpeg_bits_skip (JpegBits *bits, int n)
-{
- bits->ptr += n;
- if (bits->ptr > bits->end) {
- bits->error = TRUE;
- bits->ptr = bits->end;
- }
-}
-
-int jpeg_bits_get_u16_be (JpegBits *bits)
-{
- int x;
-
- x = jpeg_bits_get_u8 (bits) << 8;
- x |= jpeg_bits_get_u8 (bits);
-
- return x;
-}
-
-int jpeg_bits_available (JpegBits *bits)
-{
- return bits->end - bits->ptr;
-}
-
-int bits_needbits(JpegBits *b, int n_bytes)
-{
- if(b->ptr==NULL)return 1;
- if(b->ptr + n_bytes > b->end)return 1;
-
- return 0;
-}
-
-int getbit(JpegBits *b)
-{
- int r;
-
- r = ((*b->ptr)>>(7-b->idx))&1;
-
- b->idx++;
- if(b->idx>=8){
- b->ptr++;
- b->idx = 0;
- }
-
- return r;
-}
-
-unsigned int getbits(JpegBits *b, int n)
-{
- unsigned long r = 0;
- int i;
-
- for(i=0;i<n;i++){
- r <<=1;
- r |= getbit(b);
- }
-
- return r;
-}
-
-unsigned int peekbits(JpegBits *b, int n)
-{
- JpegBits tmp = *b;
-
- return getbits(&tmp, n);
-}
-
-int getsbits(JpegBits *b, int n)
-{
- unsigned long r = 0;
- int i;
-
- if(n==0)return 0;
- r = -getbit(b);
- for(i=1;i<n;i++){
- r <<=1;
- r |= getbit(b);
- }
-
- return r;
-}
-
-unsigned int peek_u8(JpegBits *b)
-{
- return *b->ptr;
-}
-
-unsigned int get_u8(JpegBits *b)
-{
- return *b->ptr++;
-}
-
-unsigned int get_u16(JpegBits *b)
-{
- unsigned int r;
-
- r = b->ptr[0] | (b->ptr[1]<<8);
- b->ptr+=2;
-
- return r;
-}
-
-unsigned int get_be_u16(JpegBits *b)
-{
- unsigned int r;
-
- r = (b->ptr[0]<<8) | b->ptr[1];
- b->ptr+=2;
-
- return r;
-}
-
-unsigned int get_u32(JpegBits *b)
-{
- unsigned int r;
-
- r = b->ptr[0] | (b->ptr[1]<<8) | (b->ptr[2]<<16) | (b->ptr[3]<<24);
- b->ptr+=4;
-
- return r;
-}
-
-void syncbits(JpegBits *b)
-{
- if(b->idx){
- b->ptr++;
- b->idx=0;
- }
-
-}
-
diff --git a/libswfdec/jpeg/jpeg_bits.h b/libswfdec/jpeg/jpeg_bits.h
deleted file mode 100644
index 90cdcec..0000000
--- a/libswfdec/jpeg/jpeg_bits.h
+++ /dev/null
@@ -1,32 +0,0 @@
-
-#ifndef __BITS_H__
-#define __BITS_H__
-
-typedef struct _JpegBits JpegBits;
-struct _JpegBits {
- unsigned char *ptr;
- int idx;
- unsigned char *end;
- int error;
-};
-
-int jpeg_bits_error (JpegBits *bits);
-int jpeg_bits_get_u8 (JpegBits *bits);
-void jpeg_bits_skip (JpegBits *bits, int n);
-int jpeg_bits_get_u16_be (JpegBits *bits);
-int jpeg_bits_available (JpegBits *bits);
-
-int bits_needbits(JpegBits *b, int n_bytes);
-int getbit(JpegBits *b);
-unsigned int getbits(JpegBits *b, int n);
-unsigned int peekbits(JpegBits *b, int n);
-int getsbits(JpegBits *b, int n);
-unsigned int peek_u8(JpegBits *b);
-unsigned int get_u8(JpegBits *b);
-unsigned int get_u16(JpegBits *b);
-unsigned int get_be_u16(JpegBits *b);
-unsigned int get_u32(JpegBits *b);
-void syncbits(JpegBits *b);
-
-#endif
-
diff --git a/libswfdec/jpeg/jpeg_huffman.c b/libswfdec/jpeg/jpeg_huffman.c
deleted file mode 100644
index d5b7f61..0000000
--- a/libswfdec/jpeg/jpeg_huffman.c
+++ /dev/null
@@ -1,168 +0,0 @@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <cogcompat.h>
-#include <liboil/liboil.h>
-
-#include <string.h>
-
-#include "jpeg.h"
-
-/* misc helper function definitions */
-
-static char *sprintbits (char *str, unsigned int bits, int n);
-
-
-void
-huffman_table_dump (HuffmanTable * table)
-{
- unsigned int n_bits;
- unsigned int code;
- char str[33];
- int i;
- HuffmanEntry *entry;
-
- COG_DEBUG ("dumping huffman table %p", table);
- for (i = 0; i < table->len; i++) {
- entry = table->entries + i;
- n_bits = entry->n_bits;
- code = entry->symbol >> (16 - n_bits);
- sprintbits (str, code, n_bits);
- COG_DEBUG ("%s --> %d", str, entry->value);
- }
-}
-
-void
-huffman_table_init (HuffmanTable *table)
-{
- memset (table, 0, sizeof(HuffmanTable));
-}
-
-void
-huffman_table_add (HuffmanTable * table, uint32_t code, int n_bits, int value)
-{
- HuffmanEntry *entry = table->entries + table->len;
-
- entry->value = value;
- entry->symbol = code << (16 - n_bits);
- entry->mask = 0xffff ^ (0xffff >> n_bits);
- entry->n_bits = n_bits;
-
- table->len++;
-}
-
-unsigned int
-huffman_table_decode_jpeg (JpegDecoder *dec, HuffmanTable * tab, JpegBits * bits)
-{
- unsigned int code;
- int i;
- char str[33];
- HuffmanEntry *entry;
-
- code = peekbits (bits, 16);
- for (i = 0; i < tab->len; i++) {
- entry = tab->entries + i;
- if ((code & entry->mask) == entry->symbol) {
- code = getbits (bits, entry->n_bits);
- sprintbits (str, code, entry->n_bits);
- COG_DEBUG ("%s --> %d", str, entry->value);
- return entry->value;
- }
- }
- COG_ERROR ("huffman sync lost");
-
- return -1;
-}
-
-int
-huffman_table_decode_macroblock (JpegDecoder *dec, short *block, HuffmanTable * dc_tab,
- HuffmanTable * ac_tab, JpegBits * bits)
-{
- int r, s, x, rs;
- int k;
- char str[33];
-
- memset (block, 0, sizeof (short) * 64);
-
- s = huffman_table_decode_jpeg (dec, dc_tab, bits);
- if (s < 0)
- return -1;
- x = getbits (bits, s);
- if ((x >> (s - 1)) == 0) {
- x -= (1 << s) - 1;
- }
- COG_DEBUG ("s=%d (block[0]=%d)", s, x);
- block[0] = x;
-
- for (k = 1; k < 64; k++) {
- rs = huffman_table_decode_jpeg (dec, ac_tab, bits);
- if (rs < 0) {
- COG_DEBUG ("huffman error");
- return -1;
- }
- if (bits->ptr > bits->end) {
- COG_DEBUG ("overrun");
- return -1;
- }
- s = rs & 0xf;
- r = rs >> 4;
- if (s == 0) {
- if (r == 15) {
- COG_DEBUG ("r=%d s=%d (skip 16)", r, s);
- k += 15;
- } else {
- COG_DEBUG ("r=%d s=%d (eob)", r, s);
- break;
- }
- } else {
- k += r;
- if (k >= 64) {
- jpeg_decoder_error (dec, "macroblock overrun");
- return -1;
- }
- x = getbits (bits, s);
- sprintbits (str, x, s);
- if ((x >> (s - 1)) == 0) {
- x -= (1 << s) - 1;
- }
- block[k] = x;
- COG_DEBUG ("r=%d s=%d (%s -> block[%d]=%d)", r, s, str, k, x);
- }
- }
- return 0;
-}
-
-int
-huffman_table_decode (JpegDecoder *dec, HuffmanTable * dc_tab, HuffmanTable * ac_tab,
- JpegBits * bits)
-{
- int16_t zz[64];
- int ret;
-
- while (bits->ptr < bits->end) {
- ret = huffman_table_decode_macroblock (dec, zz, dc_tab, ac_tab, bits);
- if (ret < 0)
- return -1;
- }
-
- return 0;
-}
-
-/* misc helper functins */
-
-static char *
-sprintbits (char *str, unsigned int bits, int n)
-{
- int i;
- int bit = 1 << (n - 1);
-
- for (i = 0; i < n; i++) {
- str[i] = (bits & bit) ? '1' : '0';
- bit >>= 1;
- }
- str[i] = 0;
-
- return str;
-}
diff --git a/libswfdec/jpeg/jpeg_huffman.h b/libswfdec/jpeg/jpeg_huffman.h
deleted file mode 100644
index 9763e09..0000000
--- a/libswfdec/jpeg/jpeg_huffman.h
+++ /dev/null
@@ -1,37 +0,0 @@
-
-#ifndef _HUFFMAN_H_
-#define _HUFFMAN_H_
-
-#include <liboil/liboil-stdint.h>
-
-#include "jpeg_bits.h"
-
-typedef struct _HuffmanEntry HuffmanEntry;
-typedef struct _HuffmanTable HuffmanTable;
-
-struct _HuffmanEntry {
- unsigned int symbol;
- unsigned int mask;
- int n_bits;
- unsigned char value;
-};
-
-struct _HuffmanTable {
- int len;
- HuffmanEntry entries[256];
-};
-
-
-void huffman_table_init(HuffmanTable *table);
-
-void huffman_table_dump(HuffmanTable *table);
-void huffman_table_add(HuffmanTable *table, uint32_t code, int n_bits,
- int value);
-unsigned int huffman_table_decode_jpeg(HuffmanTable *tab, JpegBits *bits);
-int huffman_table_decode_macroblock(short *block, HuffmanTable *dc_tab,
- HuffmanTable *ac_tab, JpegBits *bits);
-int huffman_table_decode(HuffmanTable *dc_tab, HuffmanTable *ac_tab, JpegBits *bits);
-
-
-#endif
-
diff --git a/libswfdec/jpeg/jpeg_markers.h b/libswfdec/jpeg/jpeg_markers.h
deleted file mode 100644
index 584cb23..0000000
--- a/libswfdec/jpeg/jpeg_markers.h
+++ /dev/null
@@ -1,44 +0,0 @@
-
-#define JPEG_MARKER_STUFFED 0x00
-#define JPEG_MARKER_TEM 0x01
-#define JPEG_MARKER_RES 0x02
-
-#define JPEG_MARKER_SOF_0 0xc0
-#define JPEG_MARKER_SOF_1 0xc1
-#define JPEG_MARKER_SOF_2 0xc2
-#define JPEG_MARKER_SOF_3 0xc3
-#define JPEG_MARKER_DHT 0xc4
-#define JPEG_MARKER_SOF_5 0xc5
-#define JPEG_MARKER_SOF_6 0xc6
-#define JPEG_MARKER_SOF_7 0xc7
-#define JPEG_MARKER_JPG 0xc8
-#define JPEG_MARKER_SOF_9 0xc9
-#define JPEG_MARKER_SOF_10 0xca
-#define JPEG_MARKER_SOF_11 0xcb
-#define JPEG_MARKER_DAC 0xcc
-#define JPEG_MARKER_SOF_13 0xcd
-#define JPEG_MARKER_SOF_14 0xce
-#define JPEG_MARKER_SOF_15 0xcf
-
-#define JPEG_MARKER_RST_0 0xd0
-#define JPEG_MARKER_RST_1 0xd1
-#define JPEG_MARKER_RST_2 0xd2
-#define JPEG_MARKER_RST_3 0xd3
-#define JPEG_MARKER_RST_4 0xd4
-#define JPEG_MARKER_RST_5 0xd5
-#define JPEG_MARKER_RST_6 0xd6
-#define JPEG_MARKER_RST_7 0xd7
-#define JPEG_MARKER_SOI 0xd8
-#define JPEG_MARKER_EOI 0xd9
-#define JPEG_MARKER_SOS 0xda
-#define JPEG_MARKER_DQT 0xdb
-#define JPEG_MARKER_DNL 0xdc
-#define JPEG_MARKER_DRI 0xdd
-#define JPEG_MARKER_DHP 0xde
-#define JPEG_MARKER_EXP 0xdf
-#define JPEG_MARKER_APP(x) (0xe0 + (x))
-#define JPEG_MARKER_JPG_(x) (0xf0 + (x))
-#define JPEG_MARKER_COM 0xfe
-
-#define JPEG_MARKER_JFIF JPEG_MARKER_APP(0)
-
diff --git a/libswfdec/jpeg/jpeg_rgb_decoder.c b/libswfdec/jpeg/jpeg_rgb_decoder.c
deleted file mode 100644
index 3c01914..0000000
--- a/libswfdec/jpeg/jpeg_rgb_decoder.c
+++ /dev/null
@@ -1,352 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "jpeg.h"
-
-#include <liboil/liboil.h>
-#include <liboil/liboildebug.h>
-
-#define CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
-#define oil_argb(a,r,g,b) \
- ((oil_clamp_255(a)<<24) | \
- (oil_clamp_255(r)<<16) | \
- (oil_clamp_255(g)<<8) | \
- (oil_clamp_255(b)<<0))
-#define oil_max(x,y) ((x)>(y)?(x):(y))
-#define oil_min(x,y) ((x)<(y)?(x):(y))
-#define oil_clamp_255(x) oil_max(0,oil_min((x),255))
-
-
-static int16_t jfif_matrix[24] = {
- 0, 0, -8192, -8192,
- 16384, 0, 0, 0,
- 0, 16384, 16384, 16384,
- 0, 0, -5638, 29032,
- 0, 22970, -11700, 0,
- 0, 0, 0, 0
-};
-
-
-uint32_t * get_argb_444 (JpegDecoder *dec);
-uint32_t * get_argb_422 (JpegDecoder *dec);
-uint32_t * get_argb_422v (JpegDecoder *dec);
-uint32_t * get_argb_420 (JpegDecoder *dec);
-
-#if 0
-static void imagescale2h_u8 (unsigned char *dest, int d_rowstride,
- unsigned char *src, int src_rowstride, int width, int height);
-static void imagescale2v_u8 (unsigned char *dest, int d_rowstride,
- unsigned char *src, int src_rowstride, int width, int height);
-static void imagescale2h2v_u8 (unsigned char *dest, int d_rowstride,
- unsigned char *src, int src_rowstride, int width, int height);
-static void scanlinescale2_u8 (unsigned char *dest, unsigned char *src,
- int len);
-#endif
-
-
-int jpeg_decode_argb (uint8_t *data, int length, uint32_t **image,
- int *width, int *height)
-{
- JpegDecoder *dec;
- int ret;
-
- dec = jpeg_decoder_new();
-
- jpeg_decoder_addbits (dec, data, length);
- ret = jpeg_decoder_decode(dec);
-
- if (!ret) return FALSE;
-
- jpeg_decoder_get_image_size (dec, width, height);
- *image = (uint32_t *)jpeg_decoder_get_argb_image (dec);
- jpeg_decoder_free (dec);
-
- return TRUE;
-}
-
-uint32_t *
-jpeg_decoder_get_argb_image (JpegDecoder *dec)
-{
-
- if (dec->n_components == 3) {
- if (dec->components[0].h_subsample == 1 &&
- dec->components[0].v_subsample == 1 &&
- dec->components[1].h_subsample == dec->components[2].h_subsample &&
- dec->components[1].v_subsample == dec->components[2].v_subsample) {
- if (dec->components[1].h_subsample == 1 &&
- dec->components[1].v_subsample == 1) {
- return get_argb_444 (dec);
- } else if (dec->components[1].h_subsample == 2 &&
- dec->components[1].v_subsample == 1) {
- return get_argb_422 (dec);
- } else if (dec->components[1].h_subsample == 1 &&
- dec->components[1].v_subsample == 2) {
- return get_argb_422v (dec);
- } else if (dec->components[1].h_subsample == 2 &&
- dec->components[1].v_subsample == 2) {
- return get_argb_420 (dec);
- }
- }
- }
-
- return NULL;
-}
-
-static void
-yuv_mux (uint32_t *dest, uint8_t *src_y, uint8_t *src_u, uint8_t *src_v,
- int n)
-{
- int i;
- for (i = 0; i < n; i++) {
- dest[i] = oil_argb(255, src_y[i], src_u[i], src_v[i]);
- }
-}
-
-static void
-upsample (uint8_t *d, uint8_t *s, int n)
-{
- int i;
-
- d[0] = s[0];
-
- for (i = 0; i < n-3; i+=2) {
- d[i + 1] = (3*s[i/2] + s[i/2+1] + 2)>>2;
- d[i + 2] = (s[i/2] + 3*s[i/2+1] + 2)>>2;
- }
-
- if (n&1) {
- i = n-3;
- d[n-2] = s[n/2];
- d[n-1] = s[n/2];
- } else {
- d[n-1] = s[n/2-1];
- }
-
-}
-
-uint32_t *
-get_argb_444 (JpegDecoder *dec)
-{
- uint32_t *tmp;
- uint32_t *argb_image;
- uint8_t *yp, *up, *vp;
- uint32_t *argbp;
- int j;
-
- tmp = malloc (4 * dec->width * dec->height);
- argb_image = malloc (4 * dec->width * dec->height);
-
- yp = dec->components[0].image;
- up = dec->components[1].image;
- vp = dec->components[2].image;
- argbp = argb_image;
- for(j=0;j<dec->height;j++){
- yuv_mux (tmp, yp, up, vp, dec->width);
- oil_colorspace_argb(argbp, tmp, jfif_matrix, dec->width);
- yp += dec->components[0].rowstride;
- up += dec->components[1].rowstride;
- vp += dec->components[2].rowstride;
- argbp += dec->width;
- }
- free(tmp);
- return argb_image;
-}
-
-uint32_t *
-get_argb_422 (JpegDecoder *dec)
-{
- uint32_t *tmp;
- uint8_t *tmp_u;
- uint8_t *tmp_v;
- uint32_t *argb_image;
- uint8_t *yp, *up, *vp;
- uint32_t *argbp;
- int j;
-
- tmp = malloc (4 * dec->width * dec->height);
- tmp_u = malloc (dec->width);
- tmp_v = malloc (dec->width);
- argb_image = malloc (4 * dec->width * dec->height);
-
- yp = dec->components[0].image;
- up = dec->components[1].image;
- vp = dec->components[2].image;
- argbp = argb_image;
- for(j=0;j<dec->height;j++){
- upsample (tmp_u, up, dec->width);
- upsample (tmp_v, vp, dec->width);
- yuv_mux (tmp, yp, tmp_u, tmp_v, dec->width);
- oil_colorspace_argb(argbp, tmp, jfif_matrix, dec->width);
- yp += dec->components[0].rowstride;
- up += dec->components[1].rowstride;
- vp += dec->components[2].rowstride;
- argbp += dec->width;
- }
- free(tmp);
- free(tmp_u);
- free(tmp_v);
- return argb_image;
-}
-
-uint32_t *
-get_argb_422v (JpegDecoder *dec)
-{
- uint32_t *tmp;
- uint8_t *tmp_u;
- uint8_t *tmp_v;
- uint32_t *argb_image;
- uint8_t *yp, *up, *vp;
- uint32_t *argbp;
- int halfheight;
- int j;
-
- tmp = malloc (4 * dec->width * dec->height);
- tmp_u = malloc (dec->width);
- tmp_v = malloc (dec->width);
- argb_image = malloc (4 * dec->width * dec->height);
-
- yp = dec->components[0].image;
- up = dec->components[1].image;
- vp = dec->components[2].image;
- argbp = argb_image;
- halfheight = (dec->height+1)>>1;
- for(j=0;j<dec->height;j++){
- uint32_t weight = 192 - 128*(j&1);
-
- oil_merge_linear_u8(tmp_u,
- up + dec->components[1].rowstride * CLAMP((j-1)/2,0,halfheight-1),
- up + dec->components[1].rowstride * CLAMP((j+1)/2,0,halfheight-1),
- &weight, dec->width);
- oil_merge_linear_u8(tmp_v,
- vp + dec->components[2].rowstride * CLAMP((j-1)/2,0,halfheight-1),
- vp + dec->components[2].rowstride * CLAMP((j+1)/2,0,halfheight-1),
- &weight, dec->width);
-
- yuv_mux (tmp, yp, tmp_u, tmp_v, dec->width);
- oil_colorspace_argb(argbp, tmp, jfif_matrix, dec->width);
- yp += dec->components[0].rowstride;
- argbp += dec->width;
- }
- free(tmp);
- free(tmp_u);
- free(tmp_v);
- return argb_image;
-}
-
-uint32_t *
-get_argb_420 (JpegDecoder *dec)
-{
- uint32_t *tmp;
- uint8_t *tmp_u;
- uint8_t *tmp_v;
- uint8_t *tmp1;
- uint32_t *argb_image;
- uint8_t *yp, *up, *vp;
- uint32_t *argbp;
- int j;
- int halfwidth;
- int halfheight;
-
- halfwidth = (dec->width + 1)>>1;
- tmp = malloc (4 * dec->width * dec->height);
- tmp_u = malloc (dec->width);
- tmp_v = malloc (dec->width);
- tmp1 = malloc (halfwidth);
- argb_image = malloc (4 * dec->width * dec->height);
-
- yp = dec->components[0].image;
- up = dec->components[1].image;
- vp = dec->components[2].image;
- argbp = argb_image;
- halfheight = (dec->height+1)>>1;
- for(j=0;j<dec->height;j++){
- uint32_t weight = 192 - 128*(j&1);
-
- oil_merge_linear_u8(tmp1,
- up + dec->components[1].rowstride * CLAMP((j-1)/2,0,halfheight-1),
- up + dec->components[1].rowstride * CLAMP((j+1)/2,0,halfheight-1),
- &weight, halfwidth);
- upsample (tmp_u, tmp1, dec->width);
- oil_merge_linear_u8(tmp1,
- vp + dec->components[2].rowstride * CLAMP((j-1)/2,0,halfheight-1),
- vp + dec->components[2].rowstride * CLAMP((j+1)/2,0,halfheight-1),
- &weight, halfwidth);
- upsample (tmp_v, tmp1, dec->width);
-
- yuv_mux (tmp, yp, tmp_u, tmp_v, dec->width);
- oil_colorspace_argb(argbp, tmp, jfif_matrix, dec->width);
- yp += dec->components[0].rowstride;
- argbp += dec->width;
- }
- free(tmp);
- free(tmp_u);
- free(tmp_v);
- free(tmp1);
- return argb_image;
-}
-
-#if 0
-int
-jpeg_rgb_decoder_get_image (JpegRGBDecoder * rgbdec,
- unsigned char **image, int *rowstride, int *width, int *height)
-{
- int i;
-
- jpeg_decoder_get_image_size (rgbdec->dec, &rgbdec->width, &rgbdec->height);
- for (i = 0; i < 3; i++) {
- jpeg_decoder_get_component_ptr (rgbdec->dec, i + 1,
- &rgbdec->component[i].image, &rgbdec->component[i].rowstride);
- jpeg_decoder_get_component_subsampling (rgbdec->dec, i + 1,
- &rgbdec->component[i].h_subsample, &rgbdec->component[i].v_subsample);
- rgbdec->component[i].alloc = 0;
- if (rgbdec->component[i].h_subsample > 1 ||
- rgbdec->component[i].v_subsample > 1) {
- unsigned char *dest;
-
- dest = malloc (rgbdec->width * rgbdec->height);
- if (rgbdec->component[i].v_subsample > 1) {
- if (rgbdec->component[i].h_subsample > 1) {
- imagescale2h2v_u8 (dest,
- rgbdec->width,
- rgbdec->component[i].image,
- rgbdec->component[i].rowstride, rgbdec->width, rgbdec->height);
- } else {
- imagescale2v_u8 (dest,
- rgbdec->width,
- rgbdec->component[i].image,
- rgbdec->component[i].rowstride, rgbdec->width, rgbdec->height);
- }
- } else {
- imagescale2h_u8 (dest,
- rgbdec->width,
- rgbdec->component[i].image,
- rgbdec->component[i].rowstride, rgbdec->width, rgbdec->height);
- }
- rgbdec->component[i].alloc = 1;
- rgbdec->component[i].image = dest;
- rgbdec->component[i].rowstride = rgbdec->width;
- rgbdec->component[i].h_subsample = 1;
- rgbdec->component[i].v_subsample = 1;
- }
- }
-
- rgbdec->image = malloc (rgbdec->width * rgbdec->height * 4);
-
- convert (rgbdec);
-
- if (image)
- *image = rgbdec->image;
- if (rowstride)
- *rowstride = rgbdec->width * 4;
- if (width)
- *width = rgbdec->width;
- if (height)
- *height = rgbdec->height;
-
- return 0;
-}
-#endif
-
-
diff --git a/libswfdec/jpeg/jpeg_rgb_decoder.h b/libswfdec/jpeg/jpeg_rgb_decoder.h
deleted file mode 100644
index 08501ff..0000000
--- a/libswfdec/jpeg/jpeg_rgb_decoder.h
+++ /dev/null
@@ -1,18 +0,0 @@
-
-#ifndef _JPEG_RGB_DECODER_H_
-#define _JPEG_RGB_DECODER_H_
-
-typedef struct jpeg_rgb_decoder_struct JpegRGBDecoder;
-
-
-JpegRGBDecoder *jpeg_rgb_decoder_new(void);
-void jpeg_rgb_decoder_free(JpegRGBDecoder *dec);
-int jpeg_rgb_decoder_addbits(JpegRGBDecoder *dec, unsigned char *data, unsigned int len);
-int jpeg_rgb_decoder_parse(JpegRGBDecoder *dec);
-int jpeg_rgb_decoder_get_image(JpegRGBDecoder *dec,
- unsigned char **image, int *rowstride, int *width, int *height);
-
-
-
-#endif
-
diff --git a/libswfdec/jpeg/jpeg_tables.c b/libswfdec/jpeg/jpeg_tables.c
deleted file mode 100644
index bd2d22a..0000000
--- a/libswfdec/jpeg/jpeg_tables.c
+++ /dev/null
@@ -1,54 +0,0 @@
-
-unsigned char jpeg_standard_tables[] = {
- 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
-
- 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03,
- 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7d,
- 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31,
- 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32,
- 0x81, 0x91, 0xa1, 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52,
- 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
- 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45,
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x83,
- 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94,
- 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
- 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
- 0xd9, 0xda, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
- 0xe9, 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa,
-
- 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
- 0x0a, 0x0b,
-
- 0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04,
- 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77,
- 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06,
- 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81,
- 0x08, 0x14, 0x42, 0x91, 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33,
- 0x52, 0xf0, 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
- 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44,
- 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56,
- 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
- 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92,
- 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3,
- 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
- 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
- 0xd7, 0xd8, 0xd9, 0xda, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
- 0xe8, 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa,
-};
-
-int jpeg_standard_tables_size = sizeof(jpeg_standard_tables);
-
diff --git a/libswfdec/swfdec.h b/libswfdec/swfdec.h
deleted file mode 100644
index e2432eb..0000000
--- a/libswfdec/swfdec.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Swfdec
- * Copyright (C) 2003-2006 David Schleef <ds at schleef.org>
- * 2005-2006 Eric Anholt <eric at anholt.net>
- * 2006-2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef __SWFDEC_H__
-#define __SWFDEC_H__
-
-#include <libswfdec/swfdec_as_context.h>
-#include <libswfdec/swfdec_as_debugger.h>
-#include <libswfdec/swfdec_as_frame.h>
-#include <libswfdec/swfdec_as_function.h>
-#include <libswfdec/swfdec_as_native_function.h>
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_script.h>
-
-#include <libswfdec/swfdec_audio.h>
-#include <libswfdec/swfdec_buffer.h>
-#include <libswfdec/swfdec_enums.h>
-#include <libswfdec/swfdec_file_loader.h>
-#include <libswfdec/swfdec_keys.h>
-#include <libswfdec/swfdec_loader.h>
-#include <libswfdec/swfdec_player.h>
-#include <libswfdec/swfdec_player_scripting.h>
-#include <libswfdec/swfdec_rectangle.h>
-#include <libswfdec/swfdec_socket.h>
-#include <libswfdec/swfdec_stream.h>
-#include <libswfdec/swfdec_system.h>
-#include <libswfdec/swfdec_url.h>
-
-#endif
diff --git a/libswfdec/swfdec_accessibility.c b/libswfdec/swfdec_accessibility.c
deleted file mode 100644
index 46497d2..0000000
--- a/libswfdec/swfdec_accessibility.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Pekka Lampila <pekka.lampila at iki.fi>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "swfdec_as_internal.h"
-#include "swfdec_debug.h"
-
-SWFDEC_AS_NATIVE (1999, 0, swfdec_accessibility_isActive)
-void
-swfdec_accessibility_isActive (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- SWFDEC_STUB ("Accessibility.isActive (static)");
-}
-
-SWFDEC_AS_NATIVE (1999, 1, swfdec_accessibility_sendEvent)
-void
-swfdec_accessibility_sendEvent (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- SWFDEC_STUB ("Accessibility.sendEvent (static)");
-}
-
-SWFDEC_AS_NATIVE (1999, 2, swfdec_accessibility_updateProperties)
-void
-swfdec_accessibility_updateProperties (SwfdecAsContext *cx,
- SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
- SwfdecAsValue *ret)
-{
- SWFDEC_STUB ("Accessibility.updateProperties (static)");
-}
diff --git a/libswfdec/swfdec_amf.c b/libswfdec/swfdec_amf.c
deleted file mode 100644
index 688df0a..0000000
--- a/libswfdec/swfdec_amf.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "swfdec_amf.h"
-#include "swfdec_as_array.h"
-#include "swfdec_debug.h"
-
-typedef gboolean (* SwfdecAmfParseFunc) (SwfdecAsContext *cx, SwfdecBits *bits, SwfdecAsValue *val);
-extern const SwfdecAmfParseFunc parse_funcs[SWFDEC_AMF_N_TYPES];
-
-static gboolean
-swfdec_amf_parse_boolean (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValue *val)
-{
- SWFDEC_AS_VALUE_SET_BOOLEAN (val, swfdec_bits_get_u8 (bits) ? TRUE : FALSE);
- return TRUE;
-}
-
-static gboolean
-swfdec_amf_parse_number (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValue *val)
-{
- SWFDEC_AS_VALUE_SET_NUMBER (val, swfdec_bits_get_bdouble (bits));
- return TRUE;
-}
-
-static gboolean
-swfdec_amf_parse_string (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValue *val)
-{
- guint len = swfdec_bits_get_bu16 (bits);
- char *s;
-
- /* FIXME: the supplied version is likely incorrect */
- s = swfdec_bits_get_string_length (bits, len, context->version);
- if (s == NULL)
- return FALSE;
- SWFDEC_AS_VALUE_SET_STRING (val, swfdec_as_context_give_string (context, s));
- return TRUE;
-}
-
-static gboolean
-swfdec_amf_parse_properties (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsObject *object)
-{
- guint type;
- SwfdecAmfParseFunc func;
-
- while (swfdec_bits_left (bits)) {
- SwfdecAsValue val;
- const char *name;
-
- if (!swfdec_amf_parse_string (context, bits, &val))
- return FALSE;
- name = SWFDEC_AS_VALUE_GET_STRING (&val);
- type = swfdec_bits_get_u8 (bits);
- if (type == SWFDEC_AMF_END_OBJECT)
- break;
- if (type >= SWFDEC_AMF_N_TYPES ||
- (func = parse_funcs[type]) == NULL) {
- SWFDEC_ERROR ("no parse func for AMF type %u", type);
- goto error;
- }
- swfdec_as_object_set_variable (object, name, &val); /* GC... */
- if (!func (context, bits, &val)) {
- goto error;
- }
- swfdec_as_object_set_variable (object, name, &val);
- }
- /* no more bytes seems to end automatically */
- return TRUE;
-
-error:
- return FALSE;
-}
-
-static gboolean
-swfdec_amf_parse_object (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValue *val)
-{
- SwfdecAsObject *object;
-
- object = swfdec_as_object_new (context);
- if (object == NULL)
- return FALSE;
- if (!swfdec_amf_parse_properties (context, bits, object))
- return FALSE;
- SWFDEC_AS_VALUE_SET_OBJECT (val, object);
- return TRUE;
-}
-
-static gboolean
-swfdec_amf_parse_mixed_array (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValue *val)
-{
- guint len;
- SwfdecAsObject *array;
-
- len = swfdec_bits_get_bu32 (bits);
- array = swfdec_as_array_new (context);
- if (array == NULL)
- return FALSE;
- if (!swfdec_amf_parse_properties (context, bits, array))
- return FALSE;
- SWFDEC_AS_VALUE_SET_OBJECT (val, array);
- return TRUE;
-}
-
-static gboolean
-swfdec_amf_parse_array (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValue *val)
-{
- guint i, len;
- SwfdecAsObject *array;
- guint type;
- SwfdecAmfParseFunc func;
-
- len = swfdec_bits_get_bu32 (bits);
- array = swfdec_as_array_new (context);
- if (array == NULL)
- return FALSE;
- for (i = 0; i < len; i++) {
- SwfdecAsValue tmp;
- type = swfdec_bits_get_u8 (bits);
- if (type >= SWFDEC_AMF_N_TYPES ||
- (func = parse_funcs[type]) == NULL) {
- SWFDEC_ERROR ("no parse func for AMF type %u", type);
- goto fail;
- }
- if (!func (context, bits, &tmp))
- goto fail;
- swfdec_as_array_push (SWFDEC_AS_ARRAY (array), &tmp);
- }
-
- SWFDEC_AS_VALUE_SET_OBJECT (val, array);
- return TRUE;
-
-fail:
- return FALSE;
-}
-
-const SwfdecAmfParseFunc parse_funcs[SWFDEC_AMF_N_TYPES] = {
- [SWFDEC_AMF_NUMBER] = swfdec_amf_parse_number,
- [SWFDEC_AMF_BOOLEAN] = swfdec_amf_parse_boolean,
- [SWFDEC_AMF_STRING] = swfdec_amf_parse_string,
- [SWFDEC_AMF_OBJECT] = swfdec_amf_parse_object,
- [SWFDEC_AMF_MIXED_ARRAY] = swfdec_amf_parse_mixed_array,
- [SWFDEC_AMF_ARRAY] = swfdec_amf_parse_array,
-#if 0
- SWFDEC_AMF_MOVIECLIP = 4,
- SWFDEC_AMF_NULL = 5,
- SWFDEC_AMF_UNDEFINED = 6,
- SWFDEC_AMF_REFERENCE = 7,
- SWFDEC_AMF_END_OBJECT = 9,
- SWFDEC_AMF_ARRAY = 10,
- SWFDEC_AMF_DATE = 11,
- SWFDEC_AMF_BIG_STRING = 12,
- SWFDEC_AMF_RECORDSET = 14,
- SWFDEC_AMF_XML = 15,
- SWFDEC_AMF_CLASS = 16,
- SWFDEC_AMF_FLASH9 = 17,
-#endif
-};
-
-gboolean
-swfdec_amf_parse_one (SwfdecAsContext *context, SwfdecBits *bits,
- SwfdecAmfType expected_type, SwfdecAsValue *rval)
-{
- SwfdecAmfParseFunc func;
- guint type;
-
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), 0);
- g_return_val_if_fail (context->global != NULL, 0);
- g_return_val_if_fail (bits != NULL, FALSE);
- g_return_val_if_fail (rval != NULL, FALSE);
- g_return_val_if_fail (expected_type < SWFDEC_AMF_N_TYPES, FALSE);
-
- type = swfdec_bits_get_u8 (bits);
- if (type != expected_type) {
- SWFDEC_ERROR ("parse object should be type %u, but is %u",
- expected_type, type);
- return FALSE;
- }
- if (type >= SWFDEC_AMF_N_TYPES ||
- (func = parse_funcs[type]) == NULL) {
- SWFDEC_ERROR ("no parse func for AMF type %u", type);
- return FALSE;
- }
- return func (context, bits, rval);
-}
-
-guint
-swfdec_amf_parse (SwfdecAsContext *context, SwfdecBits *bits, guint n_items, ...)
-{
- va_list args;
- guint i;
-
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), 0);
- g_return_val_if_fail (context->global != NULL, 0);
- g_return_val_if_fail (bits != NULL, 0);
-
- va_start (args, n_items);
- for (i = 0; i < n_items; i++) {
- SwfdecAmfType type = va_arg (args, SwfdecAmfType);
- SwfdecAsValue *val = va_arg (args, SwfdecAsValue *);
- if (!swfdec_amf_parse_one (context, bits, type, val))
- break;
- }
- va_end (args);
- return i;
-}
-
diff --git a/libswfdec/swfdec_amf.h b/libswfdec/swfdec_amf.h
deleted file mode 100644
index 0f9c67e..0000000
--- a/libswfdec/swfdec_amf.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef __SWFDEC_AMF_H__
-#define __SWFDEC_AMF_H__
-
-#include <libswfdec/swfdec_as_context.h>
-#include <libswfdec/swfdec_bits.h>
-
-typedef enum {
- SWFDEC_AMF_NUMBER = 0,
- SWFDEC_AMF_BOOLEAN = 1,
- SWFDEC_AMF_STRING = 2,
- SWFDEC_AMF_OBJECT = 3,
- SWFDEC_AMF_MOVIECLIP = 4,
- SWFDEC_AMF_NULL = 5,
- SWFDEC_AMF_UNDEFINED = 6,
- SWFDEC_AMF_REFERENCE = 7,
- SWFDEC_AMF_MIXED_ARRAY = 8,
- SWFDEC_AMF_END_OBJECT = 9,
- SWFDEC_AMF_ARRAY = 10,
- SWFDEC_AMF_DATE = 11,
- SWFDEC_AMF_BIG_STRING = 12,
- /* what is 13? */
- SWFDEC_AMF_RECORDSET = 14,
- SWFDEC_AMF_XML = 15,
- SWFDEC_AMF_CLASS = 16,
- SWFDEC_AMF_FLASH9 = 17,
- /* add more items here */
- SWFDEC_AMF_N_TYPES
-} SwfdecAmfType;
-
-gboolean swfdec_amf_parse_one (SwfdecAsContext * context,
- SwfdecBits * bits,
- SwfdecAmfType expected_type,
- SwfdecAsValue * rval);
-guint swfdec_amf_parse (SwfdecAsContext * context,
- SwfdecBits * bits,
- guint n_items,
- ...);
-
-
-#endif
diff --git a/libswfdec/swfdec_as_array.c b/libswfdec/swfdec_as_array.c
deleted file mode 100644
index 344c087..0000000
--- a/libswfdec/swfdec_as_array.c
+++ /dev/null
@@ -1,1399 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- * 2007 Pekka Lampila <pekka.lampila at iki.fi>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "swfdec_as_array.h"
-#include "swfdec_as_context.h"
-#include "swfdec_as_frame_internal.h"
-#include "swfdec_as_function.h"
-#include "swfdec_as_internal.h"
-#include "swfdec_as_native_function.h"
-#include "swfdec_as_string.h"
-#include "swfdec_as_strings.h"
-#include "swfdec_movie.h"
-#include "swfdec_debug.h"
-
-G_DEFINE_TYPE (SwfdecAsArray, swfdec_as_array, SWFDEC_TYPE_AS_OBJECT)
-
-/**
- * SECTION:SwfdecAsArray
- * @title: SwfdecAsArray
- * @short_description: the array object
- *
- * The array object provides some convenience functions for creating and
- * modifying arrays.
- */
-
-/**
- * SwfdecAsArray
- *
- * This is the type of the array object.
- */
-
-/*
- * Internal helper functions
- */
-
-/* NB: type is important for overflow */
-static inline gint32
-swfdec_as_array_to_index (const char *str)
-{
- char *end;
- gulong l;
-
- g_return_val_if_fail (str != NULL, -1);
-
- l = strtoul (str, &end, 10);
-
- if (*end != 0 || l > G_MAXINT32)
- return -1;
-
- return l;
-}
-
-static gint32
-swfdec_as_array_length_as_integer (SwfdecAsObject *object)
-{
- SwfdecAsValue val;
- gint32 length;
-
- g_return_val_if_fail (object != NULL, 0);
-
- swfdec_as_object_get_variable (object, SWFDEC_AS_STR_length, &val);
- length = swfdec_as_value_to_integer (object->context, &val);
-
- return length;
-}
-
-static gint32
-swfdec_as_array_length (SwfdecAsObject *object)
-{
- gint32 length;
-
- length = swfdec_as_array_length_as_integer (object);
-
- if (length < 0)
- return 0;
-
- return length;
-}
-
-/**
- * swfdec_as_array_get_length:
- * @array: a #SwfdecAsArray
- *
- * Gets the current length of the @array.
- *
- * Returns: Current length of the @array, always >= 0
- **/
-gint32
-swfdec_as_array_get_length (SwfdecAsArray *array)
-{
- return swfdec_as_array_length (SWFDEC_AS_OBJECT (array));
-}
-
-static void
-swfdec_as_array_set_length_object (SwfdecAsObject *object, gint32 length)
-{
- SwfdecAsValue val;
-
- g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
-
- SWFDEC_AS_VALUE_SET_INT (&val, length);
- swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_length, &val,
- SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
-}
-
-/**
- * swfdec_as_array_set_length:
- * @array: a #SwfdecAsArray
- * @length: the new length
- *
- * Sets the length of the @array. Values outside the new length will be
- * removed.
- **/
-void
-swfdec_as_array_set_length (SwfdecAsArray *array, gint32 length)
-{
- g_return_if_fail (SWFDEC_IS_AS_ARRAY (array));
- g_return_if_fail (length >= 0);
-
- swfdec_as_array_set_length_object (SWFDEC_AS_OBJECT (array), length);
-}
-
-typedef struct {
- gint32 start_index;
- gint32 num;
-} ForeachRemoveRangeData;
-
-static gboolean
-swfdec_as_array_foreach_remove_range (SwfdecAsObject *object,
- const char *variable, SwfdecAsValue *value, guint flags, gpointer data)
-{
- ForeachRemoveRangeData *fdata = data;
- gint32 idx;
-
- idx = swfdec_as_array_to_index (variable);
- if (idx == -1)
- return FALSE;
-
- if (idx >= fdata->start_index && idx < fdata->start_index + fdata->num)
- return TRUE;
-
- return FALSE;
-}
-
-static void
-swfdec_as_array_remove_range (SwfdecAsArray *array, gint32 start_index,
- gint32 num)
-{
- SwfdecAsObject *object = SWFDEC_AS_OBJECT (array);
-
- g_return_if_fail (SWFDEC_IS_AS_ARRAY (array));
- g_return_if_fail (start_index >= 0);
- g_return_if_fail (num >= 0);
- g_return_if_fail (start_index + num <= swfdec_as_array_length (object));
-
- if (num == 0)
- return;
-
- // to avoid foreach loop, use special case when removing just one variable
- if (num == 1) {
- swfdec_as_object_delete_variable (object,
- swfdec_as_integer_to_string (object->context, start_index));
- } else {
- ForeachRemoveRangeData fdata = { start_index, num };
- swfdec_as_object_foreach_remove (object,
- swfdec_as_array_foreach_remove_range, &fdata);
- }
-}
-
-typedef struct {
- gint32 start_index;
- gint32 num;
- gint32 to_index;
-} ForeachMoveRangeData;
-
-static const char *
-swfdec_as_array_foreach_move_range (SwfdecAsObject *object,
- const char *variable, SwfdecAsValue *value, guint flags, gpointer data)
-{
- ForeachMoveRangeData *fdata = data;
- gint32 idx;
-
- idx = swfdec_as_array_to_index (variable);
- if (idx == -1)
- return variable;
-
- if (idx >= fdata->start_index && idx < fdata->start_index + fdata->num) {
- return swfdec_as_integer_to_string (object->context,
- fdata->to_index + idx - fdata->start_index);
- } else if (idx >= fdata->to_index && idx < fdata->to_index + fdata->num) {
- return NULL;
- } else {
- return variable;
- }
-}
-
-static void
-swfdec_as_array_move_range (SwfdecAsObject *object, gint32 from_index,
- gint32 num, gint32 to_index)
-{
- ForeachMoveRangeData fdata = { from_index, num, to_index };
-
- g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
- g_return_if_fail (from_index >= 0);
- g_return_if_fail (num >= 0);
- g_return_if_fail (from_index + num <= swfdec_as_array_length (object));
- g_return_if_fail (to_index >= 0);
-
- if (num == 0 || from_index == to_index)
- return;
-
- swfdec_as_object_foreach_rename (object, swfdec_as_array_foreach_move_range,
- &fdata);
-
- // only changes length if it becomes bigger, not if it becomes smaller
- if (to_index + num > swfdec_as_array_length (object))
- swfdec_as_array_set_length_object (object, to_index + num);
-}
-
-static void
-swfdec_as_array_set_range_with_flags (SwfdecAsObject *object,
- gint32 start_index, gint32 num, const SwfdecAsValue *value,
- SwfdecAsVariableFlag flags)
-{
- gint32 i;
- const char *var;
-
- // allow negative indexes
- g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
- g_return_if_fail (num >= 0);
- g_return_if_fail (num == 0 || value != NULL);
-
- for (i = 0; i < num; i++) {
- var = swfdec_as_integer_to_string (object->context, start_index + i);
- swfdec_as_object_set_variable_and_flags (object, var, &value[i], flags);
- }
-}
-
-static void
-swfdec_as_array_set_range (SwfdecAsObject *object, gint32 start_index,
- gint32 num, const SwfdecAsValue *value)
-{
- swfdec_as_array_set_range_with_flags (object, start_index, num, value, 0);
-}
-
-static void
-swfdec_as_array_append_internal (SwfdecAsObject *object, guint n,
- const SwfdecAsValue *value)
-{
- // allow negative length
- swfdec_as_array_set_range (object,
- swfdec_as_array_length_as_integer (object), n, value);
-}
-
-/**
- * swfdec_as_array_push:
- * @array: a #SwfdecAsArray
- * @value: the value to add
- *
- * Adds the given @value to the @array. This is a macro that just calls
- * swfdec_as_array_append_with_flags().
- */
-
-/**
- * swfdec_as_array_push_with_flags:
- * @array: a #SwfdecAsArray
- * @value: the value to add
- * @flags: the #SwfdecAsVariableFlag flags to use
- *
- * Adds the given @value to the @array with the given @flags. This is a macro
- * that just calls swfdec_as_array_append_with_flags().
- */
-
-/**
- * swfdec_as_array_append:
- * @array: a #SwfdecAsArray
- * @n: number of values to add
- * @values: the values to add
- *
- * Appends the given @values to the @array. This is a macro that just calls
- * swfdec_as_array_append_with_flags().
- **/
-
-/**
- * swfdec_as_array_append_with_flags:
- * @array: a #SwfdecAsArray
- * @n: number of values to add
- * @values: the values to add
- * @flags: the #SwfdecAsVariableFlag flags to use
- *
- * Appends the given @values to the @array using the given @flags.
- **/
-void
-swfdec_as_array_append_with_flags (SwfdecAsArray *array, guint n,
- const SwfdecAsValue *value, SwfdecAsVariableFlag flags)
-{
- g_return_if_fail (SWFDEC_IS_AS_ARRAY (array));
- g_return_if_fail (n == 0 || value != NULL);
-
- // don't allow negative length
- swfdec_as_array_set_range_with_flags (SWFDEC_AS_OBJECT (array),
- swfdec_as_array_length (SWFDEC_AS_OBJECT (array)), n, value, flags);
-}
-
-/**
- * swfdec_as_array_insert:
- * @array: a #SwfdecAsArray
- * @idx: index to insert the value to
- * @value: a #SwfdecAsValue
- *
- * Inserts @value to @array at given index, making room for it by moving
- * elements to bigger indexes if necessary. This is a macro that just calls
- * swfdec_as_array_insert_with_flags().
- **/
-/**
- * swfdec_as_array_insert_with_flags:
- * @array: a #SwfdecAsArray
- * @idx: index to insert the value to
- * @value: a #SwfdecAsValue
- * @flags: the #SwfdecAsVariableFlag flags to use
- *
- * Inserts @value to @array at given index using given @flags, making room for
- * it by moving elements to bigger indexes if necessary.
- **/
-void
-swfdec_as_array_insert_with_flags (SwfdecAsArray *array, gint32 idx,
- const SwfdecAsValue *value, SwfdecAsVariableFlag flags)
-{
- gint32 length;
- SwfdecAsObject *object;
-
- g_return_if_fail (SWFDEC_IS_AS_ARRAY (array));
- g_return_if_fail (idx >= 0);
- g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
-
- object = SWFDEC_AS_OBJECT (array);
- length = swfdec_as_array_length (object);
-
- if (idx < length)
- swfdec_as_array_move_range (object, idx, length - idx, idx + 1);
- swfdec_as_array_set_range_with_flags (object, idx, 1, value, flags);
-}
-
-/**
- * swfdec_as_array_remove:
- * @array: a #SwfdecAsArray
- * @idx: index of the value to remove
- *
- * Removes value at given index from the @array, elements with higher indexes
- * will be moved towards the start of the @array.
- **/
-void
-swfdec_as_array_remove (SwfdecAsArray *array, gint32 idx)
-{
- gint32 length;
- SwfdecAsObject *object;
-
- g_return_if_fail (SWFDEC_IS_AS_ARRAY (array));
- g_return_if_fail (idx >= 0);
-
- object = SWFDEC_AS_OBJECT (array);
- length = swfdec_as_array_length (object);
-
- if (idx >= length)
- return;
-
- swfdec_as_array_move_range (object, idx + 1, length - (idx + 1), idx);
- swfdec_as_array_set_length (array, length - 1);
-}
-
-/**
- * swfdec_as_array_get_value:
- * @array: a #SwfdecAsArray
- * @idx: index of the value to get
- * @value: a pointer to #SwfdecAsValue that will be set
- *
- * Gets a value from given index, if the value doesn't exists an undefined
- * value is set.
- **/
-void
-swfdec_as_array_get_value (SwfdecAsArray *array, gint32 idx,
- SwfdecAsValue *value)
-{
- const char *var;
-
- g_assert (SWFDEC_IS_AS_ARRAY (array));
- g_assert (idx >= 0);
- g_assert (value != NULL);
-
- var = swfdec_as_integer_to_string (SWFDEC_AS_OBJECT (array)->context, idx);
- swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (array), var, value);
-}
-
-/**
- * swfdec_as_array_set_value:
- * @array: a #SwfdecAsArray
- * @idx: index of the value to set
- * @value: a pointer to #SwfdecAsValue
- *
- * Sets a @value to given index. The @array's length will be increased if
- * necessary.
- **/
-void
-swfdec_as_array_set_value (SwfdecAsArray *array, gint32 idx,
- SwfdecAsValue *value)
-{
- const char *var;
-
- g_assert (SWFDEC_IS_AS_ARRAY (array));
- g_assert (idx >= 0);
- g_assert (SWFDEC_IS_AS_VALUE (value));
-
- var = swfdec_as_integer_to_string (SWFDEC_AS_OBJECT (array)->context, idx);
- swfdec_as_object_set_variable (SWFDEC_AS_OBJECT (array), var, value);
-}
-
-typedef struct {
- SwfdecAsObject *object_to;
- gint32 offset;
- gint32 start_index;
- gint32 num;
-} ForeachAppendArrayRangeData;
-
-static gboolean
-swfdec_as_array_foreach_append_array_range (SwfdecAsObject *object,
- const char *variable, SwfdecAsValue *value, guint flags, gpointer data)
-{
- ForeachAppendArrayRangeData *fdata = data;
- gint32 idx;
- const char *var;
-
- idx = swfdec_as_array_to_index (variable);
- if (idx >= fdata->start_index && idx < fdata->start_index + fdata->num) {
- var = swfdec_as_integer_to_string (fdata->object_to->context,
- fdata->offset + (idx - fdata->start_index));
- swfdec_as_object_set_variable (fdata->object_to, var, value);
- }
-
- return TRUE;
-}
-
-static void
-swfdec_as_array_append_array_range (SwfdecAsArray *array_to,
- SwfdecAsObject *object_from, gint32 start_index, gint32 num)
-{
- ForeachAppendArrayRangeData fdata;
-
- g_return_if_fail (SWFDEC_IS_AS_ARRAY (array_to));
- g_return_if_fail (SWFDEC_IS_AS_OBJECT (object_from));
- g_return_if_fail (start_index >= 0);
- g_return_if_fail (
- start_index + num <= swfdec_as_array_length (object_from));
-
- if (num == 0)
- return;
-
- fdata.object_to = SWFDEC_AS_OBJECT (array_to);
- fdata.offset = swfdec_as_array_length (SWFDEC_AS_OBJECT (array_to));
- fdata.start_index = start_index;
- fdata.num = num;
-
- swfdec_as_array_set_length_object (fdata.object_to,
- fdata.offset + fdata.num);
- swfdec_as_object_foreach (object_from,
- swfdec_as_array_foreach_append_array_range, &fdata);
-}
-
-static void
-swfdec_as_array_append_array (SwfdecAsArray *array_to,
- SwfdecAsObject *object_from)
-{
- swfdec_as_array_append_array_range (array_to, object_from, 0,
- swfdec_as_array_length (object_from));
-}
-
-/*
- * Class functions
- */
-
-static void
-swfdec_as_array_set (SwfdecAsObject *object, const char *variable,
- const SwfdecAsValue *val, guint flags)
-{
- char *end;
- gboolean indexvar = TRUE;
- gint32 l = strtoul (variable, &end, 10);
-
- if (*end != 0 || l > G_MAXINT32)
- indexvar = FALSE;
-
- // if we changed to smaller length, destroy all values that are outside it
- if (!strcmp (variable, SWFDEC_AS_STR_length)) {
- gint32 length_old = swfdec_as_array_length (object);
- gint32 length_new = MAX (0,
- swfdec_as_value_to_integer (object->context, val));
- if (length_old > length_new) {
- swfdec_as_array_remove_range (SWFDEC_AS_ARRAY (object), length_new,
- length_old - length_new);
- }
- }
-
- SWFDEC_AS_OBJECT_CLASS (swfdec_as_array_parent_class)->set (object, variable,
- val, flags);
-
- // if we added new value outside the current length, set a bigger length
- if (indexvar) {
- if (++l > swfdec_as_array_length_as_integer (object))
- swfdec_as_array_set_length_object (object, l);
- }
-}
-
-static void
-swfdec_as_array_class_init (SwfdecAsArrayClass *klass)
-{
- SwfdecAsObjectClass *asobject_class = SWFDEC_AS_OBJECT_CLASS (klass);
-
- asobject_class->set = swfdec_as_array_set;
-}
-
-static void
-swfdec_as_array_init (SwfdecAsArray *array)
-{
-}
-
-/*
- * The rest
- */
-
-/**
- * swfdec_as_array_new:
- * @context: a #SwfdecAsContext
- *
- * Creates a new #SwfdecAsArray.
- *
- * Returns: the new array or %NULL on OOM.
- **/
-SwfdecAsObject *
-swfdec_as_array_new (SwfdecAsContext *context)
-{
- SwfdecAsObject *ret;
- SwfdecAsValue val;
-
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
-
- if (!swfdec_as_context_use_mem (context, sizeof (SwfdecAsArray)))
- return NULL;
-
- ret = g_object_new (SWFDEC_TYPE_AS_ARRAY, NULL);
- swfdec_as_object_add (ret, context, sizeof (SwfdecAsArray));
- swfdec_as_object_get_variable (context->global, SWFDEC_AS_STR_Array, &val);
- if (SWFDEC_AS_VALUE_IS_OBJECT (&val))
- swfdec_as_object_set_constructor (ret, SWFDEC_AS_VALUE_GET_OBJECT (&val));
-
- swfdec_as_array_set_length (SWFDEC_AS_ARRAY (ret), 0);
-
- return ret;
-}
-
-/*** AS CODE ***/
-
-SWFDEC_AS_NATIVE (252, 7, swfdec_as_array_join)
-void
-swfdec_as_array_join (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
- SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- int i, length;
- const char *var, *str, *sep;
- SwfdecAsValue val;
-
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- if (argc > 0) {
- sep = swfdec_as_value_to_string (cx, &argv[0]);
- } else {
- sep = SWFDEC_AS_STR_COMMA;
- }
-
- length = swfdec_as_array_length (object);
- if (length > 0) {
- /* FIXME: implement this with the StringBuilder class */
- GString *string;
- swfdec_as_object_get_variable (object, SWFDEC_AS_STR_0, &val);
- str = swfdec_as_value_to_string (cx, &val);
- string = g_string_new (str);
- for (i = 1; i < length; i++) {
- var = swfdec_as_integer_to_string (cx, i);
- swfdec_as_object_get_variable (object, var, &val);
- var = swfdec_as_value_to_string (cx, &val);
- g_string_append (string, sep);
- g_string_append (string, var);
- }
- str = swfdec_as_context_give_string (cx, g_string_free (string, FALSE));
- } else {
- str = SWFDEC_AS_STR_EMPTY;
- }
-
- SWFDEC_AS_VALUE_SET_STRING (ret, str);
-}
-
-SWFDEC_AS_NATIVE (252, 9, swfdec_as_array_toString)
-void
-swfdec_as_array_toString (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- swfdec_as_array_join (cx, object, 0, NULL, ret);
-}
-
-SWFDEC_AS_NATIVE (252, 1, swfdec_as_array_do_push)
-void
-swfdec_as_array_do_push (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- // if 0 args, just return the length
- // manually set the length here to make the function work on non-Arrays
- if (argc > 0) {
- gint32 length = swfdec_as_array_length_as_integer (object);
- swfdec_as_array_append_internal (object, argc, argv);
- swfdec_as_array_set_length_object (object, length + argc);
- }
-
- SWFDEC_AS_VALUE_SET_INT (ret, swfdec_as_array_length_as_integer (object));
-}
-
-SWFDEC_AS_NATIVE (252, 2, swfdec_as_array_do_pop)
-void
-swfdec_as_array_do_pop (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- gint32 length;
- const char *var;
-
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- // we allow negative indexes here, but not 0
- length = swfdec_as_array_length_as_integer (object);
- if (length == 0)
- return;
-
- var = swfdec_as_integer_to_string (object->context, length - 1);
- swfdec_as_object_get_variable (object, var, ret);
-
- // if Array, the length is reduced by one (which destroys the variable also)
- // else the length is not reduced at all, but the variable is still deleted
- if (SWFDEC_IS_AS_ARRAY (object)) {
- swfdec_as_array_set_length_object (object, length - 1);
- } else {
- swfdec_as_object_delete_variable (object, var);
- }
-}
-
-SWFDEC_AS_NATIVE (252, 5, swfdec_as_array_do_unshift)
-void
-swfdec_as_array_do_unshift (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- gint32 length;
-
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- if (argc) {
- // don't allow negative length
- length = swfdec_as_array_length (object);
- swfdec_as_array_move_range (object, 0, length, argc);
- swfdec_as_array_set_range (object, 0, argc, argv);
- // if not Array, leave the length unchanged
- if (!SWFDEC_IS_AS_ARRAY (object))
- swfdec_as_array_set_length_object (object, length);
- }
-
- SWFDEC_AS_VALUE_SET_INT (ret, swfdec_as_array_length (object));
-}
-
-SWFDEC_AS_NATIVE (252, 4, swfdec_as_array_do_shift)
-void
-swfdec_as_array_do_shift (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- gint32 length;
- const char *var;
-
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- // don't allow negative length
- length = swfdec_as_array_length (object);
- if (length <= 0)
- return;
-
- swfdec_as_object_get_variable (object, SWFDEC_AS_STR_0, ret);
-
- swfdec_as_array_move_range (object, 1, length - 1, 0);
-
- // if not Array, leave the length unchanged, and don't remove the element
- if (SWFDEC_IS_AS_ARRAY (object)) {
- swfdec_as_array_set_length_object (object, length - 1);
- } else {
- // we have to put the last element back, because we used move, not copy
- SwfdecAsValue val;
- if (length > 1) {
- var = swfdec_as_integer_to_string (object->context, length - 2);
- swfdec_as_object_get_variable (object, var, &val);
- } else {
- val = *ret;
- }
- var = swfdec_as_integer_to_string (object->context, length - 1);
- swfdec_as_object_set_variable (object, var, &val);
- }
-}
-
-static const char *
-swfdec_as_array_foreach_reverse (SwfdecAsObject *object, const char *variable,
- SwfdecAsValue *value, guint flags, gpointer data)
-{
- gint32 *length = data;
- gint32 idx;
-
- idx = swfdec_as_array_to_index (variable);
- if (idx == -1 || idx >= *length)
- return variable;
-
- return swfdec_as_integer_to_string (object->context, *length - 1 - idx);
-}
-
-SWFDEC_AS_NATIVE (252, 11, swfdec_as_array_reverse)
-void
-swfdec_as_array_reverse (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- gint32 length;
-
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- length = swfdec_as_array_length (object);
- swfdec_as_object_foreach_rename (object, swfdec_as_array_foreach_reverse,
- &length);
-
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
-}
-
-SWFDEC_AS_NATIVE (252, 3, swfdec_as_array_concat)
-void
-swfdec_as_array_concat (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- guint j;
- SwfdecAsObject *object_new;
- SwfdecAsArray *array_new;
- const char *var;
-
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- object_new = swfdec_as_array_new (cx);
- if (object_new == NULL)
- return;
- array_new = SWFDEC_AS_ARRAY (object_new);
-
- swfdec_as_array_append_array (array_new, object);
-
- for (j = 0; j < argc; j++) {
- if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[j]) &&
- SWFDEC_IS_AS_ARRAY (SWFDEC_AS_VALUE_GET_OBJECT (&argv[j])))
- {
- swfdec_as_array_append_array (array_new,
- SWFDEC_AS_VALUE_GET_OBJECT (&argv[j]));
- }
- else
- {
- var = swfdec_as_integer_to_string (object->context,
- swfdec_as_array_length (object_new));
- swfdec_as_object_set_variable (object_new, var, &argv[j]);
- }
- }
-
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object_new);
-}
-
-SWFDEC_AS_NATIVE (252, 6, swfdec_as_array_slice)
-void
-swfdec_as_array_slice (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
- SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- gint32 length, start_index, num;
- SwfdecAsArray *array_new;
-
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- length = swfdec_as_array_length (object);
-
- if (argc > 0) {
- start_index = swfdec_as_value_to_integer (cx, &argv[0]);
- if (start_index < 0)
- start_index = length + start_index;
- start_index = CLAMP (start_index, 0, length);
- } else {
- start_index = 0;
- }
-
- if (argc > 1) {
- gint32 endIndex = swfdec_as_value_to_integer (cx, &argv[1]);
- if (endIndex < 0)
- endIndex = length + endIndex;
- endIndex = CLAMP (endIndex, start_index, length);
- num = endIndex - start_index;
- } else {
- num = length - start_index;
- }
-
- array_new = SWFDEC_AS_ARRAY (swfdec_as_array_new (cx));
- if (array_new == NULL)
- return;
-
- swfdec_as_array_append_array_range (array_new, object, start_index, num);
-
- SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (array_new));
-}
-
-SWFDEC_AS_NATIVE (252, 8, swfdec_as_array_splice)
-void
-swfdec_as_array_splice (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- gint32 length, start_index, num_remove, num_add;
- SwfdecAsArray *array_new;
-
- if (object == NULL || SWFDEC_IS_MOVIE (object) || argc == 0)
- return;
-
- length = swfdec_as_array_length (object);
-
- start_index = swfdec_as_value_to_integer (cx, &argv[0]);
- if (start_index < 0)
- start_index = length + start_index;
- start_index = CLAMP (start_index, 0, length);
-
- if (argc > 1) {
- num_remove = CLAMP (swfdec_as_value_to_integer (cx, &argv[1]), 0,
- length - start_index);
- } else {
- num_remove = length - start_index;
- }
-
- num_add = (argc > 2 ? argc - 2 : 0);
-
- array_new = SWFDEC_AS_ARRAY (swfdec_as_array_new (cx));
- if (array_new == NULL)
- return;
-
- swfdec_as_array_append_array_range (array_new, object, start_index,
- num_remove);
- swfdec_as_array_move_range (object, start_index + num_remove,
- length - (start_index + num_remove), start_index + num_add);
- if (num_remove > num_add)
- swfdec_as_array_set_length_object (object, length - (num_remove - num_add));
- if (argc > 2)
- swfdec_as_array_set_range (object, start_index, argc - 2, argv + 2);
-
- SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (array_new));
-}
-
-// Sorting
-
-typedef enum {
- ARRAY_SORT_OPTION_CASEINSENSITIVE = 1,
- ARRAY_SORT_OPTION_DESCENDING = 2,
- ARRAY_SORT_OPTION_UNIQUESORT = 4,
- ARRAY_SORT_OPTION_RETURNINDEXEDARRAY = 8,
- ARRAY_SORT_OPTION_NUMERIC = 16
-} ArraySortOptions;
-
-typedef struct {
- SwfdecAsValue **order;
- gint32 order_size;
- SwfdecAsValue undefined;
- gint32 defined_values;
- gint32 length;
- gint32 options;
- SwfdecAsFunction *compare_custom_func;
- const char ** fields;
- SwfdecAsObject *object_new;
-} ForeachSortData;
-
-// inner function for swfdec_as_array_sort_compare
-static int
-swfdec_as_array_sort_compare_values (SwfdecAsContext *cx,
- const SwfdecAsValue *a, const SwfdecAsValue *b, gint32 options,
- SwfdecAsFunction *fun)
-{
- int retval;
-
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (cx), 0);
- g_return_val_if_fail (SWFDEC_IS_AS_VALUE (a), 0);
- g_return_val_if_fail (SWFDEC_IS_AS_VALUE (b), 0);
- g_return_val_if_fail (SWFDEC_IS_AS_VALUE (b), 0);
- g_return_val_if_fail (fun == NULL || SWFDEC_IS_AS_FUNCTION (fun), 0);
-
- if (fun != NULL)
- {
- SwfdecAsValue argv[2] = { *a, *b };
- SwfdecAsValue ret;
- swfdec_as_function_call (fun, NULL, 2, argv, &ret);
- swfdec_as_context_run (fun->object.context);
- retval = swfdec_as_value_to_integer (cx, &ret);
- }
- else if (options & ARRAY_SORT_OPTION_NUMERIC &&
- (SWFDEC_AS_VALUE_IS_NUMBER (a) ||
- SWFDEC_AS_VALUE_IS_NUMBER (b)) &&
- !SWFDEC_AS_VALUE_IS_UNDEFINED (a) &&
- !SWFDEC_AS_VALUE_IS_UNDEFINED (b))
- {
- if (!SWFDEC_AS_VALUE_IS_NUMBER (a)) {
- retval = 1;
- } else if (!SWFDEC_AS_VALUE_IS_NUMBER (b)) {
- retval = -1;
- } else {
- double an = swfdec_as_value_to_number (cx, a);
- double bn = swfdec_as_value_to_number (cx, b);
- retval = (an < bn ? -1 : (an > bn ? 1 : 0));
- }
- }
- else if (options & ARRAY_SORT_OPTION_CASEINSENSITIVE)
- {
- retval = g_strcasecmp (swfdec_as_value_to_string (cx, a),
- swfdec_as_value_to_string (cx, b));
- }
- else
- {
- retval = strcmp (swfdec_as_value_to_string (cx, a),
- swfdec_as_value_to_string (cx, b));
- }
-
- if (options & ARRAY_SORT_OPTION_DESCENDING) {
- return -retval;
- } else {
- return retval;
- }
-}
-
-static int
-swfdec_as_array_sort_compare (SwfdecAsContext *cx, const SwfdecAsValue *a,
- const SwfdecAsValue *b, gint32 options, SwfdecAsFunction *fun,
- const char **fields)
-{
- int i, retval;
- SwfdecAsValue a_comp, b_comp;
- SwfdecAsObject *object;
-
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (cx), 0);
- g_return_val_if_fail (SWFDEC_IS_AS_VALUE (a), 0);
- g_return_val_if_fail (SWFDEC_IS_AS_VALUE (b), 0);
- g_return_val_if_fail (SWFDEC_IS_AS_VALUE (b), 0);
- g_return_val_if_fail (fun == NULL || SWFDEC_IS_AS_FUNCTION (fun), 0);
- g_return_val_if_fail (fields == NULL || fields[0] != NULL, 0);
-
- if (fields == NULL)
- return swfdec_as_array_sort_compare_values (cx, a, b, options, fun);
-
- i = 0;
- do {
- object = swfdec_as_value_to_object (cx, a);
- if (object) {
- swfdec_as_object_get_variable (object, fields[i], &a_comp);
- } else {
- SWFDEC_AS_VALUE_SET_UNDEFINED (&a_comp);
- }
-
- object = swfdec_as_value_to_object (cx, b);
- if (object) {
- swfdec_as_object_get_variable (object, fields[i], &b_comp);
- } else {
- SWFDEC_AS_VALUE_SET_UNDEFINED (&b_comp);
- }
-
- retval =
- swfdec_as_array_sort_compare_values (cx, &a_comp, &b_comp, options, fun);
- } while (retval == 0 && fields[++i] != NULL);
-
- return retval;
-}
-
-// renames values in the array based on fdata->order values
-static const char *
-swfdec_as_array_foreach_sort_rename (SwfdecAsObject *object,
- const char *variable, SwfdecAsValue *value, guint flags, gpointer data)
-{
- ForeachSortData *fdata = data;
- gint32 idx, i;
- gboolean after_undefined = FALSE;
-
- idx = swfdec_as_array_to_index (variable);
- if (idx == -1 || idx >= fdata->length)
- return variable;
-
- if (SWFDEC_AS_VALUE_IS_UNDEFINED (value))
- return NULL;
-
- for (i = 0; i < fdata->order_size; i++) {
- if (fdata->order[i] == value) {
- fdata->order[i] = NULL;
- // leave room for undefined values
- if (after_undefined)
- i += fdata->length - fdata->defined_values - 1;
- return swfdec_as_integer_to_string (object->context, i);
- }
- if (fdata->order[i] == &fdata->undefined)
- after_undefined = TRUE;
- }
-
- g_assert_not_reached ();
- return NULL;
-}
-
-// fills fdata->object_new array using indexes based on the fdata->order
-static gboolean
-swfdec_as_array_foreach_sort_indexedarray (SwfdecAsObject *object,
- const char *variable, SwfdecAsValue *value, guint flags, gpointer data)
-{
- ForeachSortData *fdata = data;
- SwfdecAsValue val;
- const char *var;
- gint32 idx, i;
- gboolean after_undefined = FALSE;
-
- idx = swfdec_as_array_to_index (variable);
- if (idx == -1 || idx >= fdata->length)
- return TRUE;
-
- if (SWFDEC_AS_VALUE_IS_UNDEFINED (value))
- return TRUE;
-
- for (i = 0; i < fdata->order_size; i++) {
- if (fdata->order[i] == value) {
- fdata->order[i] = NULL;
- // leave room for undefined values, that are filled in afterwards
- if (after_undefined)
- i += fdata->length - fdata->defined_values - 1;
- var = swfdec_as_integer_to_string (object->context, i);
- SWFDEC_AS_VALUE_SET_INT (&val, idx);
- swfdec_as_object_set_variable (fdata->object_new, var, &val);
- return TRUE;
- }
- if (fdata->order[i] == &fdata->undefined)
- after_undefined = TRUE;
- }
-
- g_assert_not_reached ();
- return FALSE;
-}
-
-// sets undefined values in the fdata->object_new array to indexes of undefined
-// values in the object array
-static void
-swfdec_as_array_sort_set_undefined_indexedarray (SwfdecAsObject *object,
- ForeachSortData *fdata)
-{
- SwfdecAsValue val;
- const char *var;
- gint32 idx, i, length, num;
-
- for (idx = 0; idx < fdata->order_size; idx++) {
- if (fdata->order[idx] == &fdata->undefined)
- break;
- }
-
- num = 0;
- length = swfdec_as_array_length (object);
- for (i = 0; i < length - fdata->defined_values; i++) {
- do {
- var = swfdec_as_integer_to_string (object->context, num);
- num++;
- } while (swfdec_as_object_get_variable (object, var, &val) &&
- !SWFDEC_AS_VALUE_IS_UNDEFINED (&val));
- var = swfdec_as_integer_to_string (fdata->object_new->context, idx + i);
- SWFDEC_AS_VALUE_SET_INT (&val, num - 1);
- swfdec_as_object_set_variable (fdata->object_new, var, &val);
- }
-}
-
-// tests if any value in the array is equal to a undefined value
-// (in the sense that sorting compare function returns 0)
-// used by uniquesort when there is exactly one undefined value in the array
-static gboolean
-swfdec_as_array_foreach_sort_compare_undefined (SwfdecAsObject *object,
- const char *variable, SwfdecAsValue *value, guint flags, gpointer data)
-{
- ForeachSortData *fdata = data;
- gint32 idx;
-
- idx = swfdec_as_array_to_index (variable);
- if (idx == -1 || idx >= fdata->length)
- return TRUE;
-
- if (SWFDEC_AS_VALUE_IS_UNDEFINED (value))
- return TRUE;
-
- // when testing for uniquesort the custom compare function is NOT used
- if (swfdec_as_array_sort_compare (object->context, value, &fdata->undefined,
- fdata->options, NULL, fdata->fields) == 0)
- return FALSE;
-
- return TRUE;
-}
-
-// fill fdata->order and fdata->defined_values
-static gboolean
-swfdec_as_array_foreach_sort_populate (SwfdecAsObject *object,
- const char *variable, SwfdecAsValue *value, guint flags, gpointer data)
-{
- ForeachSortData *fdata = data;
- gint32 idx, i;
- gint cval = -1;
-
- idx = swfdec_as_array_to_index (variable);
- if (idx == -1 || idx >= fdata->length)
- return TRUE;
-
- if (SWFDEC_AS_VALUE_IS_UNDEFINED (value))
- return TRUE;
-
- fdata->defined_values++;
-
- // find the position for this value
- for (i = 0; i < fdata->order_size; i++)
- {
- if (fdata->order[i] == NULL ||
- (cval = swfdec_as_array_sort_compare (object->context, value,
- fdata->order[i], fdata->options, fdata->compare_custom_func,
- fdata->fields)) <= 0)
- {
- SwfdecAsValue *tmp2, *tmp;
-
- // if we are doing uniquesort, see if this value is the same as some
- // earlier value
- if (fdata->options & ARRAY_SORT_OPTION_UNIQUESORT &&
- fdata->order[i] != NULL && fdata->order[i] != &fdata->undefined) {
- // when using custom function, uniquesort is still based on the
- // equality given by the normal method, not the custom function
- if (fdata->compare_custom_func != NULL) {
- if (swfdec_as_array_sort_compare (object->context, value,
- fdata->order[i], fdata->options, NULL, fdata->fields) == 0) {
- return FALSE;
- }
- } else {
- if (cval == 0)
- return FALSE;
- }
- }
-
- // move rest of the values forward
- tmp = fdata->order[i];
- fdata->order[i] = value;
- while (tmp != NULL && ++i < fdata->order_size) {
- tmp2 = fdata->order[i];
- fdata->order[i] = tmp;
- tmp = tmp2;
- }
- return TRUE;
- }
- }
-
- g_assert_not_reached ();
- return FALSE;
-}
-
-static void
-swfdec_as_array_do_sort (SwfdecAsObject *object, gint32 options,
- SwfdecAsFunction *custom_compare_func, const char **fields,
- SwfdecAsValue *ret)
-{
- ForeachSortData fdata;
-
- // init foreach data
- fdata.length = swfdec_as_array_length (object);
- // FIXME: limit based on the actual amount of properties?
- fdata.order_size = fdata.length + 1;
- fdata.order = g_new0 (SwfdecAsValue *, fdata.order_size);
- SWFDEC_AS_VALUE_SET_UNDEFINED (&fdata.undefined);
- fdata.order[0] = &fdata.undefined;
- fdata.defined_values = 0;
- fdata.options = options;
- fdata.compare_custom_func = custom_compare_func;
- fdata.fields = fields;
-
- // generate fdata.order which points to the values
- if (!swfdec_as_object_foreach (object, swfdec_as_array_foreach_sort_populate,
- &fdata))
- {
- // uniquesort failed
- SWFDEC_AS_VALUE_SET_INT (ret, 0);
- g_free (fdata.order);
- return;
- }
-
- if (fdata.options & ARRAY_SORT_OPTION_UNIQUESORT &&
- fdata.defined_values + 1 < fdata.length)
- {
- // uniquesort fails, because we have more than one undefined value
- SWFDEC_AS_VALUE_SET_INT (ret, 0);
- g_free (fdata.order);
- return;
- }
-
- if (fdata.options & ARRAY_SORT_OPTION_UNIQUESORT &&
- fdata.defined_values < fdata.length)
- {
- // uniquesort used, and we have exactly one undefined value test if
- // anything equals to that
- if (!swfdec_as_object_foreach (object,
- swfdec_as_array_foreach_sort_compare_undefined, &fdata))
- {
- SWFDEC_AS_VALUE_SET_INT (ret, 0);
- g_free (fdata.order);
- return;
- }
- }
-
- if (fdata.options & ARRAY_SORT_OPTION_RETURNINDEXEDARRAY) {
- // make a new array and fill it with numbers based on the order
- fdata.object_new = swfdec_as_array_new (object->context);
- if (fdata.object_new != NULL) {
- swfdec_as_object_foreach (object,
- swfdec_as_array_foreach_sort_indexedarray, &fdata);
- // we have values that have been set now, fill in the undefined values
- swfdec_as_array_sort_set_undefined_indexedarray (object, &fdata);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, fdata.object_new);
- }
- } else {
- // rename properties based on the new order
- swfdec_as_object_foreach_rename (object,
- swfdec_as_array_foreach_sort_rename, &fdata);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
- }
-
- g_free (fdata.order);
-}
-
-SWFDEC_AS_NATIVE (252, 10, swfdec_as_array_sort)
-void
-swfdec_as_array_sort (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
- SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- guint pos;
- gint32 options;
- SwfdecAsFunction *custom_compare_func;
-
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- pos = 0;
- if (argc > 0 && !SWFDEC_AS_VALUE_IS_NUMBER (&argv[0])) {
- SwfdecAsFunction *fun;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]) ||
- !SWFDEC_IS_AS_FUNCTION (
- fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (&argv[0])))
- return;
- custom_compare_func = fun;
- pos++;
- } else {
- custom_compare_func = NULL;
- }
-
- if (argc > pos) {
- options = swfdec_as_value_to_integer (cx, &argv[pos]);
- } else {
- options = 0;
- }
-
- swfdec_as_array_do_sort (object, options, custom_compare_func, NULL, ret);
-}
-
-SWFDEC_AS_NATIVE (252, 12, swfdec_as_array_sortOn)
-void
-swfdec_as_array_sortOn (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- const char **fields;
- gint32 options;
-
- if (object == NULL || SWFDEC_IS_MOVIE (object))
- return;
-
- if (argc < 1)
- return;
-
- if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[0])) {
- gint32 length, i;
- SwfdecAsValue val;
- SwfdecAsObject *array;
-
- array = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
- if (!SWFDEC_IS_AS_ARRAY (array)) {
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
- return;
- }
- length = swfdec_as_array_get_length (SWFDEC_AS_ARRAY (array));
- if (length <= 0) {
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
- return;
- }
- fields = g_malloc (sizeof (const char *) * (length + 1));
- for (i = 0; i < length; i++) {
- swfdec_as_array_get_value (SWFDEC_AS_ARRAY (array), i, &val);
- if (SWFDEC_AS_VALUE_IS_OBJECT (&val) &&
- SWFDEC_IS_AS_STRING (SWFDEC_AS_VALUE_GET_OBJECT (&val))) {
- fields[i] =
- SWFDEC_AS_STRING (SWFDEC_AS_VALUE_GET_OBJECT (&val))->string;
- } else {
- fields[i] = swfdec_as_value_to_string (cx, &val);
- }
- }
- fields[i] = NULL;
- } else {
- fields = g_malloc (sizeof (const char *) * 2);
- fields[0] = swfdec_as_value_to_string (cx, &argv[0]);
- fields[1] = NULL;
- }
-
- if (argc > 1) {
- options = swfdec_as_value_to_integer (cx, &argv[1]);
- } else {
- options = 0;
- }
-
- swfdec_as_array_do_sort (object, options, NULL, fields, ret);
-
- g_free (fields);
-}
-
-// Constructor
-
-SWFDEC_AS_CONSTRUCTOR (252, 0, swfdec_as_array_construct, swfdec_as_array_get_type)
-void
-swfdec_as_array_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- SwfdecAsArray *array;
-
- if (!cx->frame->construct) {
- SwfdecAsValue val;
- if (!swfdec_as_context_use_mem (cx, sizeof (SwfdecAsArray)))
- return;
- object = g_object_new (SWFDEC_TYPE_AS_ARRAY, NULL);
- swfdec_as_object_add (object, cx, sizeof (SwfdecAsArray));
- swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_Array, &val);
- if (SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
- swfdec_as_object_set_constructor (object,
- SWFDEC_AS_VALUE_GET_OBJECT (&val));
- } else {
- SWFDEC_INFO ("\"Array\" is not an object");
- }
- }
-
- array = SWFDEC_AS_ARRAY (object);
- if (argc == 1 && SWFDEC_AS_VALUE_IS_NUMBER (&argv[0])) {
- int l = swfdec_as_value_to_integer (cx, &argv[0]);
- swfdec_as_array_set_length (array, l < 0 ? 0 : l);
- } else if (argc > 0) {
- swfdec_as_array_append (array, argc, argv);
- } else {
- swfdec_as_array_set_length (array, 0);
- }
-
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
-}
diff --git a/libswfdec/swfdec_as_array.h b/libswfdec/swfdec_as_array.h
deleted file mode 100644
index 4c23a7f..0000000
--- a/libswfdec/swfdec_as_array.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- * 2007 Pekka Lampila <pekka.lampila at iki.fi>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_AS_ARRAY_H_
-#define _SWFDEC_AS_ARRAY_H_
-
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
-
-G_BEGIN_DECLS
-
-typedef struct _SwfdecAsArrayClass SwfdecAsArrayClass;
-
-#define SWFDEC_TYPE_AS_ARRAY (swfdec_as_array_get_type())
-#define SWFDEC_IS_AS_ARRAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_AS_ARRAY))
-#define SWFDEC_IS_AS_ARRAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_AS_ARRAY))
-#define SWFDEC_AS_ARRAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_AS_ARRAY, SwfdecAsArray))
-#define SWFDEC_AS_ARRAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AS_ARRAY, SwfdecAsArrayClass))
-#define SWFDEC_AS_ARRAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AS_ARRAY, SwfdecAsArrayClass))
-
-struct _SwfdecAsArray {
- /*< private >*/
- SwfdecAsObject object;
-};
-
-struct _SwfdecAsArrayClass {
- SwfdecAsObjectClass object_class;
-};
-
-GType swfdec_as_array_get_type (void);
-
-SwfdecAsObject *swfdec_as_array_new (SwfdecAsContext * context);
-
-#define swfdec_as_array_push(array,value) \
- swfdec_as_array_append_with_flags ((array), 1, (value), 0)
-#define swfdec_as_array_push_with_flags(array,value,flags) \
- swfdec_as_array_append_with_flags ((array), 1, (value), (flags))
-#define swfdec_as_array_append(array,n,values) \
- swfdec_as_array_append_with_flags ((array), (n), (values), 0)
-void swfdec_as_array_append_with_flags (SwfdecAsArray * array,
- guint n,
- const SwfdecAsValue * values,
- SwfdecAsVariableFlag flags);
-void swfdec_as_array_insert (SwfdecAsArray * array,
- gint32 idx,
- SwfdecAsValue * value);
-#define swfdec_as_array_insert(array,idx,value) \
- swfdec_as_array_insert_with_flags ((array), (idx), (value), 0)
-void swfdec_as_array_insert_with_flags (SwfdecAsArray * array,
- gint32 idx,
- const SwfdecAsValue * value,
- SwfdecAsVariableFlag flags);
-gint32 swfdec_as_array_get_length (SwfdecAsArray * array);
-void swfdec_as_array_set_length (SwfdecAsArray * array,
- gint32 length);
-void swfdec_as_array_get_value (SwfdecAsArray * array,
- gint32 idx,
- SwfdecAsValue * value);
-void swfdec_as_array_set_value (SwfdecAsArray * array,
- gint32 idx,
- SwfdecAsValue * value);
-void swfdec_as_array_remove (SwfdecAsArray * array,
- gint32 idx);
-
-
-G_END_DECLS
-#endif
diff --git a/libswfdec/swfdec_as_boolean.c b/libswfdec/swfdec_as_boolean.c
deleted file mode 100644
index b3d81dd..0000000
--- a/libswfdec/swfdec_as_boolean.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-
-#include "swfdec_as_boolean.h"
-#include "swfdec_as_context.h"
-#include "swfdec_as_internal.h"
-#include "swfdec_as_native_function.h"
-#include "swfdec_as_strings.h"
-#include "swfdec_debug.h"
-
-G_DEFINE_TYPE (SwfdecAsBoolean, swfdec_as_boolean, SWFDEC_TYPE_AS_OBJECT)
-
-static void
-swfdec_as_boolean_class_init (SwfdecAsBooleanClass *klass)
-{
-}
-
-static void
-swfdec_as_boolean_init (SwfdecAsBoolean *boolean)
-{
-}
-
-/*** AS CODE ***/
-
-SWFDEC_AS_CONSTRUCTOR (107, 2, swfdec_as_boolean_construct, swfdec_as_boolean_get_type)
-void
-swfdec_as_boolean_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- gboolean b;
-
- if (argc > 0) {
- b = swfdec_as_value_to_boolean (object->context, &argv[0]);
- } else {
- b = FALSE;
- }
-
- if (swfdec_as_context_is_constructing (cx)) {
- SWFDEC_AS_BOOLEAN (object)->boolean = b;
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
- } else {
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, b);
- }
-}
-
-SWFDEC_AS_NATIVE (107, 1, swfdec_as_boolean_toString)
-void
-swfdec_as_boolean_toString (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- SwfdecAsBoolean *b;
-
- if (!SWFDEC_IS_AS_BOOLEAN (object))
- return;
- b = SWFDEC_AS_BOOLEAN (object);
-
- SWFDEC_AS_VALUE_SET_STRING (ret, b->boolean ? SWFDEC_AS_STR_true : SWFDEC_AS_STR_false);
-}
-
-SWFDEC_AS_NATIVE (107, 0, swfdec_as_boolean_valueOf)
-void
-swfdec_as_boolean_valueOf (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- SwfdecAsBoolean *b;
-
- if (!SWFDEC_IS_AS_BOOLEAN (object))
- return;
- b = SWFDEC_AS_BOOLEAN (object);
-
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, b->boolean);
-}
-
-// only available as ASnative
-SWFDEC_AS_NATIVE (3, 2, swfdec_as_boolean_old_constructor)
-void
-swfdec_as_boolean_old_constructor (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
-{
- SWFDEC_STUB ("old 'Boolean' function (only available as ASnative)");
-}
diff --git a/libswfdec/swfdec_as_boolean.h b/libswfdec/swfdec_as_boolean.h
deleted file mode 100644
index 723f076..0000000
--- a/libswfdec/swfdec_as_boolean.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_AS_BOOLEAN_H_
-#define _SWFDEC_AS_BOOLEAN_H_
-
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
-
-G_BEGIN_DECLS
-
-typedef struct _SwfdecAsBoolean SwfdecAsBoolean;
-typedef struct _SwfdecAsBooleanClass SwfdecAsBooleanClass;
-
-#define SWFDEC_TYPE_AS_BOOLEAN (swfdec_as_boolean_get_type())
-#define SWFDEC_IS_AS_BOOLEAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_AS_BOOLEAN))
-#define SWFDEC_IS_AS_BOOLEAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_AS_BOOLEAN))
-#define SWFDEC_AS_BOOLEAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_AS_BOOLEAN, SwfdecAsBoolean))
-#define SWFDEC_AS_BOOLEAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AS_BOOLEAN, SwfdecAsBooleanClass))
-#define SWFDEC_AS_BOOLEAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AS_BOOLEAN, SwfdecAsBooleanClass))
-
-struct _SwfdecAsBoolean {
- SwfdecAsObject object;
-
- gboolean boolean; /* boolean represented by this boolean object */
-};
-
-struct _SwfdecAsBooleanClass {
- SwfdecAsObjectClass object_class;
-};
-
-GType swfdec_as_boolean_get_type (void);
-
-
-G_END_DECLS
-#endif
diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
deleted file mode 100644
index ccce123..0000000
--- a/libswfdec/swfdec_as_context.c
+++ /dev/null
@@ -1,1461 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include "swfdec_as_context.h"
-#include "swfdec_as_array.h"
-#include "swfdec_as_frame_internal.h"
-#include "swfdec_as_function.h"
-#include "swfdec_as_initialize.h"
-#include "swfdec_as_internal.h"
-#include "swfdec_as_interpret.h"
-#include "swfdec_as_native_function.h"
-#include "swfdec_as_object.h"
-#include "swfdec_as_stack.h"
-#include "swfdec_as_strings.h"
-#include "swfdec_as_types.h"
-#include "swfdec_debug.h"
-#include "swfdec_internal.h" /* for swfdec_player_preinit_global() */
-#include "swfdec_script.h"
-
-/*** GARBAGE COLLECTION DOCS ***/
-
-#define SWFDEC_AS_GC_MARK (1 << 0) /* only valid during GC */
-#define SWFDEC_AS_GC_ROOT (1 << 1) /* for objects: rooted, for strings: static */
-
-/**
- * SECTION:Internals
- * @title: Internals and garbage collection
- * @short_description: understanding internals such as garbage collection
- * @see_also: #SwfdecAsContext
- *
- * This section deals with the internals of the Swfdec Actionscript engine. You
- * should probably read this first when trying to write code with it. If you're
- * just trying to use Swfdec for creating Flash content, you can probably skip
- * this section.
- *
- * First, I'd like to note that the Swfdec script engine has to be modeled very
- * closely after the existing Flash players. So if there are some behaviours
- * that seem stupid at first sight, it might very well be that it was chosen for
- * a very particular reason. Now on to the features.
- *
- * The Swfdec script engine tries to imitate Actionscript as good as possible.
- * Actionscript is similar to Javascript, but not equal. Depending on the
- * version of the script executed it might be more or less similar. An important
- * example is that Flash in versions up to 6 did case-insensitive variable
- * lookups.
- *
- * The script engine starts its life when it is initialized via
- * swfdec_as_context_startup (). At that point, the basic objects are created.
- * After this function has been called, you can start executing code. All code
- * execution happens by creating a new #SwfdecAsFrame and then calling
- * swfdec_as_context_run() to execute it. This function is the single entry
- * point for code execution. Convenience functions exist that make executing
- * code easy, most notably swfdec_as_object_run() and
- * swfdec_as_object_call().
- *
- * It is also easily possible to extend the environment by adding new objects.
- * In fact, without doing so, the environment is pretty bare as it just contains
- * the basic Math, String, Number, Array, Date and Boolean objects. This is done
- * by adding #SwfdecAsNative functions to the environment. The easy way
- * to do this is via swfdec_as_object_add_function().
- *
- * The Swfdec script engine is dynamically typed and knows about different types
- * of values. See #SwfdecAsValue for the different values. Memory management is
- * done using a mark and sweep garbage collector. You can initiate a garbage
- * collection cycle by calling swfdec_as_context_gc() or
- * swfdec_as_context_maybe_gc(). You should do this regularly to avoid excessive
- * memory use. The #SwfdecAsContext will then collect the objects and strings it
- * is keeping track of. If you want to use an object or string in the script
- * engine, you'll have to add it first via swfdec_as_object_add() or
- * swfdec_as_context_get_string() and swfdec_as_context_give_string(),
- * respectively.
- *
- * Garbage-collected strings are special in Swfdec in that they are unique. This
- * means the same string exists exactly once. Because of this you can do
- * equality comparisons using == instead of strcmp. It also means that if you
- * forget to add a string to the context before using it, your app will most
- * likely not work, since the string will not compare equal to any other string.
- *
- * When a garbage collection cycle happens, all reachable objects and strings
- * are marked and all unreachable ones are freed. This is done by calling the
- * context class's mark function which will mark all reachable objects. This is
- * usually called the "root set". For any reachable object, the object's mark
- * function is called so that the object in turn can mark all objects it can
- * reach itself. Marking is done via functions described below.
- */
-
-/*** GTK-DOC ***/
-
-/**
- * SECTION:SwfdecAsContext
- * @title: SwfdecAsContext
- * @short_description: the main script engine context
- * @see_also: SwfdecPlayer
- *
- * A #SwfdecAsContext provides the main execution environment for Actionscript
- * execution. It provides the objects typically available in ECMAScript and
- * manages script execution, garbage collection etc. #SwfdecPlayer is a
- * subclass of the context that implements Flash specific objects on top of it.
- * However, it is possible to use the context for completely different functions
- * where a sandboxed scripting environment is needed. An example is the Swfdec
- * debugger.
- * <note>The Actionscript engine is similar, but not equal to Javascript. It
- * is not very different, but it is different.</note>
- */
-
-/**
- * SwfdecAsContext
- *
- * This is the main object ued to hold the state of a script engine. All members
- * are private and should not be accessed.
- *
- * Subclassing this structure to get scripting support in your own appliation is
- * encouraged.
- */
-
-/**
- * SwfdecAsContextState
- * @SWFDEC_AS_CONTEXT_NEW: the context is not yet initialized,
- * swfdec_as_context_startup() needs to be called.
- * @SWFDEC_AS_CONTEXT_RUNNING: the context is running normally
- * @SWFDEC_AS_CONTEXT_INTERRUPTED: the context has been interrupted by a
- * debugger
- * @SWFDEC_AS_CONTEXT_ABORTED: the context has aborted execution due to a
- * fatal error
- *
- * The state of the context describes what operations are possible on the context.
- * It will be in the state @SWFDEC_AS_CONTEXT_STATE_RUNNING almost all the time. If
- * it is in the state @SWFDEC_AS_CONTEXT_STATE_ABORTED, it will not work anymore and
- * every operation on it will instantly fail.
- */
-
-/*** RUNNING STATE ***/
-
-/**
- * swfdec_as_context_abort:
- * @context: a #SwfdecAsContext
- * @reason: a string describing why execution was aborted
- *
- * Aborts script execution in @context. Call this functon if the script engine
- * encountered a fatal error and cannot continue. A possible reason for this is
- * an out-of-memory condition.
- **/
-void
-swfdec_as_context_abort (SwfdecAsContext *context, const char *reason)
-{
- g_return_if_fail (context);
-
- SWFDEC_ERROR ("%s", reason);
- if (context->state != SWFDEC_AS_CONTEXT_ABORTED) {
- context->state = SWFDEC_AS_CONTEXT_ABORTED;
- g_object_notify (G_OBJECT (context), "aborted");
- }
-}
-
-/*** MEMORY MANAGEMENT ***/
-
-/**
- * swfdec_as_context_use_mem:
- * @context: a #SwfdecAsContext
- * @bytes: number of bytes to use
- *
- * Registers @bytes additional bytes as in use by the @context. This function
- * keeps track of the memory that script code consumes. If too many memory is
- * in use, this function may decide to stop the script engine with an out of
- * memory error.
- *
- * Returns: %TRUE if the memory could be allocated. %FALSE on OOM.
- **/
-gboolean
-swfdec_as_context_use_mem (SwfdecAsContext *context, gsize bytes)
-{
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), FALSE);
- g_return_val_if_fail (bytes > 0, FALSE);
-
- if (context->state == SWFDEC_AS_CONTEXT_ABORTED)
- return FALSE;
-
- context->memory += bytes;
- context->memory_since_gc += bytes;
- SWFDEC_LOG ("+%4"G_GSIZE_FORMAT" bytes, total %7"G_GSIZE_FORMAT" (%7"G_GSIZE_FORMAT" since GC)",
- bytes, context->memory, context->memory_since_gc);
- /* FIXME: Don't foget to abort on OOM */
- return TRUE;
-}
-
-/**
- * swfdec_as_context_unuse_mem:
- * @context: a #SwfdecAsContext
- * @bytes: number of bytes to release
- *
- * Releases a number of bytes previously allocated using
- * swfdec_as_context_use_mem(). See that function for details.
- **/
-void
-swfdec_as_context_unuse_mem (SwfdecAsContext *context, gsize bytes)
-{
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
- g_return_if_fail (bytes > 0);
- g_return_if_fail (context->memory >= bytes);
-
- context->memory -= bytes;
- SWFDEC_LOG ("-%4"G_GSIZE_FORMAT" bytes, total %7"G_GSIZE_FORMAT" (%7"G_GSIZE_FORMAT" since GC)",
- bytes, context->memory, context->memory_since_gc);
-}
-
-/*** GC ***/
-
-static gboolean
-swfdec_as_context_remove_strings (gpointer key, gpointer value, gpointer data)
-{
- SwfdecAsContext *context = data;
- char *string;
-
- string = (char *) value;
- /* it doesn't matter that rooted strings aren't destroyed, they're constant */
- if (string[0] & SWFDEC_AS_GC_ROOT) {
- SWFDEC_LOG ("rooted: %s", (char *) key);
- return FALSE;
- } else if (string[0] & SWFDEC_AS_GC_MARK) {
- SWFDEC_LOG ("marked: %s", (char *) key);
- string[0] &= ~SWFDEC_AS_GC_MARK;
- return FALSE;
- } else {
- gsize len;
- SWFDEC_LOG ("deleted: %s", (char *) key);
- len = (strlen ((char *) key) + 2);
- swfdec_as_context_unuse_mem (context, len);
- g_slice_free1 (len, value);
- return TRUE;
- }
-}
-
-static gboolean
-swfdec_as_context_remove_objects (gpointer key, gpointer value, gpointer debugger)
-{
- SwfdecAsObject *object;
-
- object = key;
- /* we only check for mark here, not root, since this works on destroy, too */
- if (object->flags & SWFDEC_AS_GC_MARK) {
- object->flags &= ~SWFDEC_AS_GC_MARK;
- SWFDEC_LOG ("%s: %s %p", (object->flags & SWFDEC_AS_GC_ROOT) ? "rooted" : "marked",
- G_OBJECT_TYPE_NAME (object), object);
- return FALSE;
- } else {
- SWFDEC_LOG ("deleted: %s %p", G_OBJECT_TYPE_NAME (object), object);
- if (debugger) {
- SwfdecAsDebuggerClass *klass = SWFDEC_AS_DEBUGGER_GET_CLASS (debugger);
- if (klass->remove)
- klass->remove (debugger, object->context, object);
- }
- swfdec_as_object_collect (object);
- return TRUE;
- }
-}
-
-static void
-swfdec_as_context_collect (SwfdecAsContext *context)
-{
- SWFDEC_INFO (">> collecting garbage");
- /* NB: This functions is called without GC from swfdec_as_context_dispose */
- g_hash_table_foreach_remove (context->strings,
- swfdec_as_context_remove_strings, context);
- g_hash_table_foreach_remove (context->objects,
- swfdec_as_context_remove_objects, context->debugger);
- SWFDEC_INFO (">> done collecting garbage");
-}
-
-/**
- * swfdec_as_object_mark:
- * @object: a #SwfdecAsObject
- *
- * Mark @object as being in use. Calling this function is only valid during
- * the marking phase of garbage collection.
- **/
-void
-swfdec_as_object_mark (SwfdecAsObject *object)
-{
- SwfdecAsObjectClass *klass;
-
- g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
-
- if (object->flags & SWFDEC_AS_GC_MARK)
- return;
- object->flags |= SWFDEC_AS_GC_MARK;
- klass = SWFDEC_AS_OBJECT_GET_CLASS (object);
- g_assert (klass->mark);
- klass->mark (object);
-}
-
-/**
- * swfdec_as_string_mark:
- * @string: a garbage-collected string
- *
- * Mark @string as being in use. Calling this function is only valid during
- * the marking phase of garbage collection.
- **/
-void
-swfdec_as_string_mark (const char *string)
-{
- char *str;
-
- g_return_if_fail (string != NULL);
-
- str = (char *) string - 1;
- if (*str == 0)
- *str = SWFDEC_AS_GC_MARK;
-}
-
-/**
- * swfdec_as_value_mark:
- * @value: a #SwfdecAsValue
- *
- * Mark @value as being in use. This is just a convenience function that calls
- * the right marking function depending on the value's type. Calling this
- * function is only valid during the marking phase of garbage collection.
- **/
-void
-swfdec_as_value_mark (SwfdecAsValue *value)
-{
- g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
-
- if (SWFDEC_AS_VALUE_IS_OBJECT (value)) {
- swfdec_as_object_mark (SWFDEC_AS_VALUE_GET_OBJECT (value));
- } else if (SWFDEC_AS_VALUE_IS_STRING (value)) {
- swfdec_as_string_mark (SWFDEC_AS_VALUE_GET_STRING (value));
- }
-}
-
-static void
-swfdec_as_context_mark_roots (gpointer key, gpointer value, gpointer data)
-{
- SwfdecAsObject *object = key;
-
- if ((object->flags & (SWFDEC_AS_GC_MARK | SWFDEC_AS_GC_ROOT)) == SWFDEC_AS_GC_ROOT)
- swfdec_as_object_mark (object);
-}
-
-static void
-swfdec_as_context_do_mark (SwfdecAsContext *context)
-{
- /* This if is needed for SwfdecPlayer */
- if (context->global) {
- swfdec_as_object_mark (context->global);
- swfdec_as_object_mark (context->Function);
- swfdec_as_object_mark (context->Function_prototype);
- swfdec_as_object_mark (context->Object);
- swfdec_as_object_mark (context->Object_prototype);
- }
- if (context->exception)
- swfdec_as_value_mark (&context->exception_value);
- g_hash_table_foreach (context->objects, swfdec_as_context_mark_roots, NULL);
-}
-
-/**
- * swfdec_as_context_gc:
- * @context: a #SwfdecAsContext
- *
- * Calls the Swfdec Gargbage collector and reclaims any unused memory. You
- * should call this function or swfdec_as_context_maybe_gc() regularly.
- * <warning>Calling the GC during execution of code or initialization is not
- * allowed.</warning>
- **/
-void
-swfdec_as_context_gc (SwfdecAsContext *context)
-{
- SwfdecAsContextClass *klass;
-
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
- g_return_if_fail (context->frame == NULL);
- g_return_if_fail (context->state == SWFDEC_AS_CONTEXT_RUNNING);
-
- if (context->state == SWFDEC_AS_CONTEXT_ABORTED)
- return;
- SWFDEC_INFO ("invoking the garbage collector");
- klass = SWFDEC_AS_CONTEXT_GET_CLASS (context);
- g_assert (klass->mark);
- klass->mark (context);
- swfdec_as_context_collect (context);
- context->memory_since_gc = 0;
-}
-
-static gboolean
-swfdec_as_context_needs_gc (SwfdecAsContext *context)
-{
- return context->memory_since_gc >= context->memory_until_gc;
-}
-
-/**
- * swfdec_as_context_maybe_gc:
- * @context: a #SwfdecAsContext
- *
- * Calls the garbage collector if necessary. It's a good idea to call this
- * function regularly instead of swfdec_as_context_gc() as it only does collect
- * garage as needed. For example, #SwfdecPlayer calls this function after every
- * frame advancement.
- **/
-void
-swfdec_as_context_maybe_gc (SwfdecAsContext *context)
-{
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
- g_return_if_fail (context->state == SWFDEC_AS_CONTEXT_RUNNING);
- g_return_if_fail (context->frame == NULL);
-
- if (swfdec_as_context_needs_gc (context))
- swfdec_as_context_gc (context);
-}
-
-/*** SWFDEC_AS_CONTEXT ***/
-
-enum {
- TRACE,
- LAST_SIGNAL
-};
-
-enum {
- PROP_0,
- PROP_DEBUGGER,
- PROP_RANDOM_SEED,
- PROP_ABORTED,
- PROP_UNTIL_GC
-};
-
-G_DEFINE_TYPE (SwfdecAsContext, swfdec_as_context, G_TYPE_OBJECT)
-static guint signals[LAST_SIGNAL] = { 0, };
-
-static void
-swfdec_as_context_get_property (GObject *object, guint param_id, GValue *value,
- GParamSpec * pspec)
-{
- SwfdecAsContext *context = SWFDEC_AS_CONTEXT (object);
-
- switch (param_id) {
- case PROP_DEBUGGER:
- g_value_set_object (value, context->debugger);
- break;
- case PROP_ABORTED:
- g_value_set_boolean (value, context->state == SWFDEC_AS_CONTEXT_ABORTED);
- break;
- case PROP_UNTIL_GC:
- g_value_set_ulong (value, (gulong) context->memory_until_gc);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-swfdec_as_context_set_property (GObject *object, guint param_id, const GValue *value,
- GParamSpec * pspec)
-{
- SwfdecAsContext *context = SWFDEC_AS_CONTEXT (object);
-
- switch (param_id) {
- case PROP_DEBUGGER:
- context->debugger = SWFDEC_AS_DEBUGGER (g_value_dup_object (value));
- break;
- case PROP_RANDOM_SEED:
- g_rand_set_seed (context->rand, g_value_get_uint (value));
- break;
- case PROP_UNTIL_GC:
- context->memory_until_gc = g_value_get_ulong (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-swfdec_as_context_dispose (GObject *object)
-{
- SwfdecAsContext *context = SWFDEC_AS_CONTEXT (object);
-
- while (context->stack)
- swfdec_as_stack_pop_segment (context);
- swfdec_as_context_collect (context);
- if (context->memory != 0) {
- g_critical ("%zu bytes of memory left over\n", context->memory);
- }
- g_assert (g_hash_table_size (context->objects) == 0);
- g_hash_table_destroy (context->objects);
- g_hash_table_destroy (context->strings);
- g_rand_free (context->rand);
- if (context->debugger) {
- g_object_unref (context->debugger);
- context->debugger = NULL;
- }
-
- G_OBJECT_CLASS (swfdec_as_context_parent_class)->dispose (object);
-}
-
-static void
-swfdec_as_context_class_init (SwfdecAsContextClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = swfdec_as_context_dispose;
- object_class->get_property = swfdec_as_context_get_property;
- object_class->set_property = swfdec_as_context_set_property;
-
- g_object_class_install_property (object_class, PROP_DEBUGGER,
- g_param_spec_object ("debugger", "debugger", "debugger used in this player",
- SWFDEC_TYPE_AS_DEBUGGER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (object_class, PROP_RANDOM_SEED,
- g_param_spec_uint ("random-seed", "random seed",
- "seed used for calculating random numbers",
- 0, G_MAXUINT32, 0, G_PARAM_WRITABLE)); /* FIXME: make this readwrite for replaying? */
- g_object_class_install_property (object_class, PROP_ABORTED,
- g_param_spec_boolean ("aborted", "aborted", "set when the script engine aborts due to an error",
- FALSE, G_PARAM_READABLE));
- g_object_class_install_property (object_class, PROP_UNTIL_GC,
- g_param_spec_ulong ("memory-until-gc", "memory until gc",
- "amount of bytes that need to be allocated before garbage collection triggers",
- 0, G_MAXULONG, 8 * 1024 * 1024, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- /**
- * SwfdecAsContext::trace:
- * @context: the #SwfdecAsContext affected
- * @text: the debugging string
- *
- * Emits a debugging string while running. The effect of calling any swfdec
- * functions on the emitting @context is undefined.
- */
- signals[TRACE] = g_signal_new ("trace", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- klass->mark = swfdec_as_context_do_mark;
-}
-
-static void
-swfdec_as_context_init (SwfdecAsContext *context)
-{
- const char *s;
-
- context->version = G_MAXUINT;
-
- context->strings = g_hash_table_new (g_str_hash, g_str_equal);
- context->objects = g_hash_table_new (g_direct_hash, g_direct_equal);
-
- for (s = swfdec_as_strings; *s == '\2'; s += strlen (s) + 1) {
- g_hash_table_insert (context->strings, (char *) s + 1, (char *) s);
- }
- g_assert (*s == 0);
- context->rand = g_rand_new ();
- g_get_current_time (&context->start_time);
-}
-
-/*** STRINGS ***/
-
-static const char *
-swfdec_as_context_create_string (SwfdecAsContext *context, const char *string, gsize len)
-{
- char *new;
-
- if (!swfdec_as_context_use_mem (context, sizeof (char) * (2 + len)))
- return SWFDEC_AS_STR_EMPTY;
-
- new = g_slice_alloc (2 + len);
- memcpy (&new[1], string, len);
- new[len + 1] = 0;
- new[0] = 0; /* GC flags */
- g_hash_table_insert (context->strings, new + 1, new);
-
- return new + 1;
-}
-
-/**
- * swfdec_as_context_get_string:
- * @context: a #SwfdecAsContext
- * @string: a sting that is not garbage-collected
- *
- * Gets the garbage-collected version of @string. You need to call this function
- * for every not garbage-collected string that you want to use in Swfdecs script
- * interpreter.
- *
- * Returns: the garbage-collected version of @string
- **/
-const char *
-swfdec_as_context_get_string (SwfdecAsContext *context, const char *string)
-{
- const char *ret;
- gsize len;
-
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
- g_return_val_if_fail (string != NULL, NULL);
-
- if (g_hash_table_lookup_extended (context->strings, string, (gpointer) &ret, NULL))
- return ret;
-
- len = strlen (string);
- return swfdec_as_context_create_string (context, string, len);
-}
-
-/**
- * swfdec_as_context_give_string:
- * @context: a #SwfdecAsContext
- * @string: string to make refcounted
- *
- * Takes ownership of @string and returns a refcounted version of the same
- * string. This function is the same as swfdec_as_context_get_string(), but
- * takes ownership of @string.
- *
- * Returns: A refcounted string
- **/
-const char *
-swfdec_as_context_give_string (SwfdecAsContext *context, char *string)
-{
- const char *ret;
-
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
- g_return_val_if_fail (string != NULL, NULL);
-
- ret = swfdec_as_context_get_string (context, string);
- g_free (string);
- return ret;
-}
-
-/**
- * swfdec_as_context_is_constructing:
- * @context: a #SwfdecAsConstruct
- *
- * Determines if the contexxt is currently constructing. This information is
- * used by various constructors to do different things when they are
- * constructing and when they are not. The Boolean, Number and String functions
- * for example setup the newly constructed objects when constructing but only
- * cast the provided argument when being called.
- *
- * Returns: %TRUE if the currently executing frame is a constructor
- **/
-gboolean
-swfdec_as_context_is_constructing (SwfdecAsContext *context)
-{
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), FALSE);
-
- return context->frame && context->frame->construct;
-}
-
-/**
- * swfdec_as_context_get_frame:
- * @context: a #SwfdecAsContext
- *
- * This is a debugging function. It gets the topmost stack frame that is
- * currently executing. If no function is executing, %NULL is returned. You can
- * easily get a backtrace with code like this:
- * |[for (frame = swfdec_as_context_get_frame (context); frame != NULL;
- * frame = swfdec_as_frame_get_next (frame)) {
- * char *s = swfdec_as_object_get_debug (SWFDEC_AS_OBJECT (frame));
- * g_print ("%s\n", s);
- * g_free (s);
- * }]|
- *
- * Returns: the currently executing frame or %NULL if none
- **/
-SwfdecAsFrame *
-swfdec_as_context_get_frame (SwfdecAsContext *context)
-{
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
-
- return context->frame;
-}
-
-/**
- * swfdec_as_context_throw:
- * @context: a #SwfdecAsContext
- * @value: a #SwfdecAsValue to be thrown
- *
- * Throws a new exception in the @context using the given @value. This function
- * can only be called if the @context is not already throwing an exception.
- **/
-void
-swfdec_as_context_throw (SwfdecAsContext *context, const SwfdecAsValue *value)
-{
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
- g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
- g_return_if_fail (!context->exception);
-
- context->exception = TRUE;
- context->exception_value = *value;
-}
-
-/**
- * swfdec_as_context_catch:
- * @context: a #SwfdecAsContext
- * @value: a #SwfdecAsValue to be thrown
- *
- * Removes the currently thrown exception from @context and sets @value to the
- * thrown value
- *
- * Returns: %TRUE if an exception was catched, %FALSE otherwise
- **/
-gboolean
-swfdec_as_context_catch (SwfdecAsContext *context, SwfdecAsValue *value)
-{
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), FALSE);
-
- if (!context->exception)
- return FALSE;
-
- if (value != NULL)
- *value = context->exception_value;
-
- context->exception = FALSE;
- SWFDEC_AS_VALUE_SET_UNDEFINED (&context->exception_value);
-
- return TRUE;
-}
-
-/**
- * swfdec_as_context_get_time:
- * @context: a #SwfdecAsContext
- * @tv: a #GTimeVal to be set to the context's time
- *
- * This function queries the time to be used inside this context. By default,
- * this is the same as g_get_current_time(), but it may be overwriten to allow
- * things such as slower or faster playback.
- **/
-void
-swfdec_as_context_get_time (SwfdecAsContext *context, GTimeVal *tv)
-{
- SwfdecAsContextClass *klass;
-
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
- g_return_if_fail (tv != NULL);
-
- klass = SWFDEC_AS_CONTEXT_GET_CLASS (context);
- if (klass->get_time)
- klass->get_time (context, tv);
- else
- g_get_current_time (tv);
-}
-
-/**
- * swfdec_as_context_run:
- * @context: a #SwfdecAsContext
- *
- * Continues running the script engine. Executing code in this engine works
- * in 2 steps: First, you push the frame to be executed onto the stack, then
- * you call this function to execute it. So this function is the single entry
- * point to script execution. This might be helpful when debugging your
- * application.
- * <note>A lot of convenience functions like swfdec_as_object_run() call this
- * function automatically.</note>
- **/
-void
-swfdec_as_context_run (SwfdecAsContext *context)
-{
- SwfdecAsFrame *frame, *last_frame;
- SwfdecScript *script;
- const SwfdecActionSpec *spec;
- const guint8 *startpc, *pc, *endpc, *nextpc, *exitpc;
-#ifndef G_DISABLE_ASSERT
- SwfdecAsValue *check;
-#endif
- guint action, len;
- const guint8 *data;
- guint original_version;
- void (* step) (SwfdecAsDebugger *debugger, SwfdecAsContext *context);
- gboolean check_block; /* some opcodes avoid a scope check */
-
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
-
- if (context->frame == NULL || context->state == SWFDEC_AS_CONTEXT_ABORTED)
- return;
-
- if (context->debugger) {
- SwfdecAsDebuggerClass *klass = SWFDEC_AS_DEBUGGER_GET_CLASS (context->debugger);
- step = klass->step;
- } else {
- step = NULL;
- }
-
- last_frame = context->last_frame;
- context->last_frame = context->frame->next;
- original_version = context->version;
-start:
- g_return_if_fail (context->global); /* check here because of swfdec_sandbox_(un)use() */
- if (!swfdec_as_context_check_continue (context))
- goto error;
- /* setup data */
- frame = context->frame;
- if (frame == context->last_frame)
- goto out;
- if (context->call_depth > 256) {
- /* we've exceeded our maximum call depth, throw an error and abort */
- swfdec_as_context_abort (context, "Stack overflow");
- goto error;
- }
- if (SWFDEC_IS_AS_NATIVE_FUNCTION (frame->function)) {
- SwfdecAsNativeFunction *native = SWFDEC_AS_NATIVE_FUNCTION (frame->function);
- SwfdecAsValue rval = { 0, };
- if (frame->argc >= native->min_args &&
- (native->type == 0 ||
- g_type_is_a (G_OBJECT_TYPE (frame->thisp), native->type))) {
- SwfdecAsValue *argv;
- /* accumulate argv */
- if (frame->argc == 0 || frame->argv != NULL) {
- /* FIXME FIXME FIXME: no casting here please! */
- argv = (SwfdecAsValue *) frame->argv;
- } else {
- SwfdecAsStack *stack;
- SwfdecAsValue *cur;
- guint i;
- if (frame->argc > 128) {
- SWFDEC_FIXME ("allow calling native functions with more than 128 args (this one has %u)",
- frame->argc);
- frame->argc = 128;
- }
- argv = g_new (SwfdecAsValue, frame->argc);
- stack = context->stack;
- cur = context->cur;
- for (i = 0; i < frame->argc; i++) {
- if (cur <= &stack->elements[0]) {
- stack = stack->next;
- cur = &stack->elements[stack->used_elements];
- }
- cur--;
- argv[i] = *cur;
- }
- }
- native->native (context, frame->thisp, frame->argc,
- argv, &rval);
- if (argv != frame->argv)
- g_free (argv);
- }
- swfdec_as_frame_return (frame, &rval);
- goto start;
- }
- g_assert (frame->script);
- g_assert (frame->target);
- script = frame->script;
- context->version = script->version;
- startpc = script->buffer->data;
- endpc = startpc + script->buffer->length;
- exitpc = script->exit;
- pc = frame->pc;
- check_block = TRUE;
-
- while (context->state < SWFDEC_AS_CONTEXT_ABORTED) {
- if (context->exception) {
- swfdec_as_frame_handle_exception (frame);
- if (frame != context->frame)
- goto start;
- pc = frame->pc;
- continue;
- }
- if (pc == exitpc) {
- swfdec_as_frame_return (frame, NULL);
- goto start;
- }
- if (pc < startpc || pc >= endpc) {
- SWFDEC_ERROR ("pc %p not in valid range [%p, %p) anymore", pc, startpc, endpc);
- goto error;
- }
- if (check_block && (pc < frame->block_start || pc >= frame->block_end)) {
- SWFDEC_LOG ("code exited block");
- swfdec_as_frame_pop_block (frame);
- pc = frame->pc;
- if (frame != context->frame)
- goto start;
- }
-
- /* decode next action */
- action = *pc;
- if (action == 0) {
- swfdec_as_frame_return (frame, NULL);
- goto start;
- }
- /* invoke debugger if there is one */
- if (step) {
- frame->pc = pc;
- (* step) (context->debugger, context);
- if (frame != context->frame ||
- frame->pc != pc) {
- goto start;
- }
- }
- /* prepare action */
- spec = swfdec_as_actions + action;
- if (action & 0x80) {
- if (pc + 2 >= endpc) {
- SWFDEC_ERROR ("action %u length value out of range", action);
- goto error;
- }
- data = pc + 3;
- len = pc[1] | pc[2] << 8;
- if (data + len > endpc) {
- SWFDEC_ERROR ("action %u length %u out of range", action, len);
- goto error;
- }
- nextpc = pc + 3 + len;
- } else {
- data = NULL;
- len = 0;
- nextpc = pc + 1;
- }
- /* check action is valid */
- if (!spec->exec) {
- SWFDEC_WARNING ("cannot interpret action %3u 0x%02X %s for version %u, skipping it", action,
- action, spec->name ? spec->name : "Unknown", script->version);
- frame->pc = pc = nextpc;
- check_block = TRUE;
- continue;
- }
- if (script->version < spec->version) {
- SWFDEC_WARNING ("cannot interpret action %3u 0x%02X %s for version %u, using version %u instead",
- action, action, spec->name ? spec->name : "Unknown", script->version, spec->version);
- }
- if (spec->remove > 0) {
- if (spec->add > spec->remove)
- swfdec_as_stack_ensure_free (context, spec->add - spec->remove);
- swfdec_as_stack_ensure_size (context, spec->remove);
- } else {
- if (spec->add > 0)
- swfdec_as_stack_ensure_free (context, spec->add);
- }
- if (context->state > SWFDEC_AS_CONTEXT_RUNNING) {
- SWFDEC_WARNING ("context not running anymore, aborting");
- goto error;
- }
-#ifndef G_DISABLE_ASSERT
- check = (spec->add >= 0 && spec->remove >= 0) ? context->cur + spec->add - spec->remove : NULL;
-#endif
- /* execute action */
- spec->exec (context, action, data, len);
- /* adapt the pc if the action did not, otherwise, leave it alone */
- /* FIXME: do this via flag? */
- if (frame->pc == pc) {
- frame->pc = pc = nextpc;
- check_block = TRUE;
- } else {
- if (frame->pc < pc &&
- !swfdec_as_context_check_continue (context)) {
- goto error;
- }
- pc = frame->pc;
- check_block = FALSE;
- }
- if (frame == context->frame) {
-#ifndef G_DISABLE_ASSERT
- if (check != NULL && check != context->cur) {
- g_error ("action %s was supposed to change the stack by %d (+%d -%d), but it changed by %td",
- spec->name, spec->add - spec->remove, spec->add, spec->remove,
- context->cur - check + spec->add - spec->remove);
- }
-#endif
- } else {
- /* someone called/returned from a function, reread variables */
- goto start;
- }
- }
-
-error:
- while (context->frame != context->last_frame)
- swfdec_as_frame_return (context->frame, NULL);
-out:
- context->last_frame = last_frame;
- context->version = original_version;
- return;
-}
-
-/*** EVAL ***/
-
-static char *
-swfdec_as_slash_to_dot (const char *slash_str)
-{
- const char *cur = slash_str;
- GString *str = g_string_new ("");
-
- if (*cur == '/') {
- g_string_append (str, "_root");
- } else {
- goto start;
- }
- while (cur && *cur == '/') {
- cur++;
-start:
- if (str->len > 0)
- g_string_append_c (str, '.');
- if (cur[0] == '.' && cur[1] == '.') {
- g_string_append (str, "_parent");
- cur += 2;
- } else {
- char *slash = strchr (cur, '/');
- if (slash) {
- g_string_append_len (str, cur, slash - cur);
- cur = slash;
- } else {
- g_string_append (str, cur);
- cur = NULL;
- }
- }
- /* cur should now point to the slash */
- }
- if (cur) {
- if (*cur != '\0')
- goto fail;
- }
- SWFDEC_DEBUG ("parsed slash-notated string \"%s\" into dot notation \"%s\"",
- slash_str, str->str);
- return g_string_free (str, FALSE);
-
-fail:
- SWFDEC_WARNING ("failed to parse slash-notated string \"%s\" into dot notation", slash_str);
- g_string_free (str, TRUE);
- return NULL;
-}
-
-static void
-swfdec_as_context_eval_get_property (SwfdecAsContext *cx,
- SwfdecAsObject *obj, const char *name, SwfdecAsValue *ret)
-{
- if (obj) {
- swfdec_as_object_get_variable (obj, name, ret);
- } else {
- if (cx->frame) {
- swfdec_as_frame_get_variable (cx->frame, name, ret);
- } else {
- SWFDEC_WARNING ("eval called without a frame");
- swfdec_as_object_get_variable (cx->global, name, ret);
- }
- }
-}
-
-static void
-swfdec_as_context_eval_set_property (SwfdecAsContext *cx,
- SwfdecAsObject *obj, const char *name, const SwfdecAsValue *ret)
-{
- if (obj == NULL) {
- if (cx->frame == NULL) {
- SWFDEC_ERROR ("no frame in eval_set?");
- return;
- }
- swfdec_as_frame_set_variable (cx->frame, name, ret);
- } else {
- swfdec_as_object_set_variable (obj, name, ret);
- }
-}
-
-static void
-swfdec_as_context_eval_internal (SwfdecAsContext *cx, SwfdecAsObject *obj, const char *str,
- SwfdecAsValue *val, gboolean set)
-{
- SwfdecAsValue cur;
- char **varlist;
- guint i;
-
- SWFDEC_LOG ("eval called with \"%s\" on %p", str, obj);
- if (strchr (str, '/')) {
- char *work = swfdec_as_slash_to_dot (str);
- if (!work) {
- SWFDEC_AS_VALUE_SET_UNDEFINED (val);
- return;
- }
- varlist = g_strsplit (work, ".", -1);
- g_free (work);
- } else {
- varlist = g_strsplit (str, ".", -1);
- }
- for (i = 0; varlist[i] != NULL; i++) {
- const char *dot = swfdec_as_context_get_string (cx, varlist[i]);
- if (varlist[i+1] != NULL) {
- swfdec_as_context_eval_get_property (cx, obj, dot, &cur);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&cur)) {
- SWFDEC_AS_VALUE_SET_UNDEFINED (&cur);
- break;
- }
- obj = SWFDEC_AS_VALUE_GET_OBJECT (&cur);
- } else {
- if (set) {
- swfdec_as_context_eval_set_property (cx, obj, dot, val);
- } else {
- swfdec_as_context_eval_get_property (cx, obj, dot, &cur);
- }
- goto finish;
- }
- }
- if (obj == NULL) {
- if (cx->frame)
- obj = cx->frame->target;
- else
- obj = cx->global;
- }
- g_assert (obj != NULL);
- SWFDEC_AS_VALUE_SET_OBJECT (&cur, obj);
-
-finish:
- g_strfreev (varlist);
- *val = cur;
-}
-
-/**
- * swfdec_as_context_eval:
- * @context: a #SwfdecAsContext
- * @obj: #SwfdecAsObject to use as source for evaluating or NULL for the
- * current frame's scope
- * @str: The string to evaluate
- * @val: location for the return value
- *
- * This function works like the Actionscript eval function used on @obj.
- * It handles both slash-style and dot-style notation. If an error occured
- * during evaluation, the return value will be the undefined value.
- **/
-void
-swfdec_as_context_eval (SwfdecAsContext *context, SwfdecAsObject *obj, const char *str,
- SwfdecAsValue *val)
-{
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
- g_return_if_fail (obj == NULL || SWFDEC_IS_AS_OBJECT (obj));
- g_return_if_fail (str != NULL);
- g_return_if_fail (val != NULL);
-
- swfdec_as_context_eval_internal (context, obj, str, val, FALSE);
-}
-
-/**
- * swfdec_as_context_eval_set:
- * @context: a #SwfdecAsContext
- * @obj: #SwfdecAsObject to use as source for evaluating or NULL for the
- * default object.
- * @str: The string to evaluate
- * @val: the value to set the variable to
- *
- * Sets the variable referenced by @str to @val. If @str does not reference
- * a valid property, nothing happens.
- **/
-void
-swfdec_as_context_eval_set (SwfdecAsContext *context, SwfdecAsObject *obj, const char *str,
- const SwfdecAsValue *val)
-{
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
- g_return_if_fail (obj == NULL || SWFDEC_IS_AS_OBJECT (obj));
- g_return_if_fail (str != NULL);
- g_return_if_fail (val != NULL);
-
- swfdec_as_context_eval_internal (context, obj, str, (SwfdecAsValue *) val, TRUE);
-}
-
-/*** AS CODE ***/
-
-static void
-swfdec_as_context_ASSetPropFlags_set_one_flag (SwfdecAsObject *object,
- const char *s, guint *flags)
-{
- swfdec_as_object_unset_variable_flags (object, s, flags[1]);
- swfdec_as_object_set_variable_flags (object, s, flags[0]);
-}
-
-static gboolean
-swfdec_as_context_ASSetPropFlags_foreach (SwfdecAsObject *object,
- const char *s, SwfdecAsValue *val, guint cur_flags, gpointer data)
-{
- guint *flags = data;
-
- /* shortcut if the flags already match */
- if (cur_flags == ((cur_flags &~ flags[1]) | flags[0]))
- return TRUE;
-
- swfdec_as_context_ASSetPropFlags_set_one_flag (object, s, flags);
- return TRUE;
-}
-
-SWFDEC_AS_NATIVE (1, 0, swfdec_as_context_ASSetPropFlags)
-void
-swfdec_as_context_ASSetPropFlags (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
-{
- guint flags[2]; /* flags and mask - array so we can pass it as data pointer */
- SwfdecAsObject *obj;
-
- if (argc < 3)
- return;
-
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]))
- return;
- obj = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
- flags[0] = swfdec_as_value_to_integer (cx, &argv[2]);
- flags[1] = (argc > 3) ? swfdec_as_value_to_integer (cx, &argv[3]) : 0;
-
- if (flags[0] == 0 && flags[1] == 0) {
- // we should add autosizing length attribute here
- SWFDEC_FIXME ("ASSetPropFlags to set special length attribute not implemented");
- return;
- }
-
- if (SWFDEC_AS_VALUE_IS_NULL (&argv[1])) {
- swfdec_as_object_foreach (obj, swfdec_as_context_ASSetPropFlags_foreach, flags);
- } else {
- char **split =
- g_strsplit (swfdec_as_value_to_string (cx, &argv[1]), ",", -1);
- guint i;
- for (i = 0; split[i]; i++) {
- swfdec_as_context_ASSetPropFlags_set_one_flag (obj,
- swfdec_as_context_get_string (cx, split[i]), flags);
- }
- g_strfreev (split);
- }
-}
-
-SWFDEC_AS_NATIVE (200, 19, swfdec_as_context_isFinite)
-void
-swfdec_as_context_isFinite (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
-{
- double d;
-
- if (argc < 1)
- return;
-
- d = swfdec_as_value_to_number (cx, &argv[0]);
- SWFDEC_AS_VALUE_SET_BOOLEAN (retval, isfinite (d) ? TRUE : FALSE);
-}
-
-SWFDEC_AS_NATIVE (200, 18, swfdec_as_context_isNaN)
-void
-swfdec_as_context_isNaN (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
-{
- double d;
-
- if (argc < 1)
- return;
-
- d = swfdec_as_value_to_number (cx, &argv[0]);
- SWFDEC_AS_VALUE_SET_BOOLEAN (retval, isnan (d) ? TRUE : FALSE);
-}
-
-SWFDEC_AS_NATIVE (100, 2, swfdec_as_context_parseInt)
-void
-swfdec_as_context_parseInt (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
-{
- const char *s;
- char *tail;
- int radix;
- gint64 i;
-
- if (argc < 1)
- return;
-
- s = swfdec_as_value_to_string (cx, &argv[0]);
-
- if (argc >= 2) {
- radix = swfdec_as_value_to_integer (cx, &argv[1]);
-
- if (radix < 2 || radix > 36) {
- SWFDEC_AS_VALUE_SET_NUMBER (retval, NAN);
- return;
- }
-
- // special case, strtol parses things that we shouldn't parse
- if (radix == 16) {
- const char *end = s + strspn (s, " \t\r\n");
- if (end != s && (end[0] == '-' || end[0] == '+'))
- end++;
- if (end != s && end[0] == '0' && (end[1] == 'x' || end[1] == 'X')) {
- SWFDEC_AS_VALUE_SET_NUMBER (retval, 0);
- return;
- }
- }
- } else {
- radix = 0;
- }
-
- // special case, don't allow sign in front of the 0x
- if ((s[0] == '-' || s[0] == '+') && s[1] == '0' &&
- (s[2] == 'x' || s[2] == 'X')) {
- SWFDEC_AS_VALUE_SET_NUMBER (retval, NAN);
- return;
- }
-
- if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) {
- s = s + 2;
- i = g_ascii_strtoll (s, &tail, (radix != 0 ? radix : 16));
- } else if (s[0] == '0' && s[strspn (s, "01234567")] == '\0') {
- i = g_ascii_strtoll (s, &tail, (radix != 0 ? radix : 8));
- } else {
- i = g_ascii_strtoll (s, &tail, (radix != 0 ? radix : 10));
- }
-
- if (tail == s) {
- SWFDEC_AS_VALUE_SET_NUMBER (retval, NAN);
- return;
- }
-
- if (i > G_MAXINT32 || i < G_MININT32) {
- SWFDEC_AS_VALUE_SET_NUMBER (retval, i);
- } else {
- SWFDEC_AS_VALUE_SET_INT (retval, i);
- }
-}
-
-SWFDEC_AS_NATIVE (100, 3, swfdec_as_context_parseFloat)
-void
-swfdec_as_context_parseFloat (SwfdecAsContext *cx, SwfdecAsObject *object,
- guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
-{
- char *s, *p, *tail;
- double d;
-
- if (argc < 1)
- return;
-
- // we need to remove everything after x or I, since strtod parses hexadecimal
- // numbers and Infinity
- s = g_strdup (swfdec_as_value_to_string (cx, &argv[0]));
- if ((p = strpbrk (s, "xXiI")) != NULL) {
- *p = '\0';
- }
-
- d = g_ascii_strtod (s, &tail);
-
- if (tail == s) {
- SWFDEC_AS_VALUE_SET_NUMBER (retval, NAN);
- } else {
- SWFDEC_AS_VALUE_SET_NUMBER (retval, d);
- }
-
- g_free (s);
-}
-
-static void
-swfdec_as_context_init_global (SwfdecAsContext *context)
-{
- SwfdecAsValue val;
-
- SWFDEC_AS_VALUE_SET_NUMBER (&val, NAN);
- swfdec_as_object_set_variable (context->global, SWFDEC_AS_STR_NaN, &val);
- SWFDEC_AS_VALUE_SET_NUMBER (&val, HUGE_VAL);
- swfdec_as_object_set_variable (context->global, SWFDEC_AS_STR_Infinity, &val);
-}
-
-void
-swfdec_as_context_run_init_script (SwfdecAsContext *context, const guint8 *data,
- gsize length, guint version)
-{
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
- g_return_if_fail (data != NULL);
- g_return_if_fail (length > 0);
-
- if (version > 4) {
- SwfdecBits bits;
- SwfdecScript *script;
- swfdec_bits_init_data (&bits, data, length);
- script = swfdec_script_new_from_bits (&bits, "init", version);
- if (script == NULL) {
- g_warning ("script passed to swfdec_as_context_run_init_script is invalid");
- return;
- }
- swfdec_as_object_run (context->global, script);
- swfdec_script_unref (script);
- } else {
- SWFDEC_LOG ("not running init script, since version is <= 4");
- }
-}
-
-/**
- * swfdec_as_context_startup:
- * @context: a #SwfdecAsContext
- * @version: Flash version to use
- *
- * Starts up the context. This function must be called before any Actionscript
- * is called on @context. The version is responsible for deciding which native
- * functions and properties are available in the context.
- **/
-void
-swfdec_as_context_startup (SwfdecAsContext *context)
-{
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
- g_return_if_fail (context->state == SWFDEC_AS_CONTEXT_NEW);
-
- if (context->cur == NULL &&
- !swfdec_as_stack_push_segment (context))
- return;
- if (context->global == NULL)
- context->global = swfdec_as_object_new_empty (context);
- /* init the two internal functions */
- /* FIXME: remove them for normal contexts? */
- swfdec_player_preinit_global (context);
- /* get the necessary objects up to define objects and functions sanely */
- swfdec_as_function_init_context (context);
- swfdec_as_object_init_context (context);
- /* define the global object and other important ones */
- swfdec_as_context_init_global (context);
-
- /* run init script */
- swfdec_as_context_run_init_script (context, swfdec_as_initialize, sizeof (swfdec_as_initialize), 8);
-
- if (context->state == SWFDEC_AS_CONTEXT_NEW)
- context->state = SWFDEC_AS_CONTEXT_RUNNING;
-}
-
-/**
- * swfdec_as_context_check_continue:
- * @context: the context that might be running too long
- *
- * Checks if the context has been running too long. If it has, it gets aborted.
- *
- * Returns: %TRUE if this player aborted.
- **/
-gboolean
-swfdec_as_context_check_continue (SwfdecAsContext *context)
-{
- SwfdecAsContextClass *klass;
-
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), TRUE);
-
- klass = SWFDEC_AS_CONTEXT_GET_CLASS (context);
- if (klass->check_continue == NULL)
- return TRUE;
- if (!klass->check_continue (context)) {
- swfdec_as_context_abort (context, "Runtime exceeded");
- return FALSE;
- }
- return TRUE;
-}
-
-/**
- * swfdec_as_context_is_aborted:
- * @context: a #SwfdecAsContext
- *
- * Determines if the given context is aborted. An aborted context is not able
- * to execute any scripts. Aborting can happen if the script engine detects bad
- * scripts that cause excessive memory usage, infinite loops or other problems.
- * In that case the script engine aborts for safety reasons.
- *
- * Returns: %TRUE if the player is aborted, %FALSE if it runs normally.
- **/
-gboolean
-swfdec_as_context_is_aborted (SwfdecAsContext *context)
-{
- g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), TRUE);
-
- return context->state == SWFDEC_AS_CONTEXT_ABORTED;
-}
-
diff --git a/libswfdec/swfdec_as_context.h b/libswfdec/swfdec_as_context.h
deleted file mode 100644
index d5ef066..0000000
--- a/libswfdec/swfdec_as_context.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_AS_CONTEXT_H_
-#define _SWFDEC_AS_CONTEXT_H_
-
-#include <glib-object.h>
-#include <libswfdec/swfdec_as_types.h>
-
-G_BEGIN_DECLS
-
-typedef enum {
- SWFDEC_AS_CONTEXT_NEW,
- SWFDEC_AS_CONTEXT_RUNNING,
- SWFDEC_AS_CONTEXT_INTERRUPTED,
- SWFDEC_AS_CONTEXT_ABORTED
-} SwfdecAsContextState;
-
-typedef struct _SwfdecAsContextClass SwfdecAsContextClass;
-
-#define SWFDEC_TYPE_AS_CONTEXT (swfdec_as_context_get_type())
-#define SWFDEC_IS_AS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_AS_CONTEXT))
-#define SWFDEC_IS_AS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_AS_CONTEXT))
-#define SWFDEC_AS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_AS_CONTEXT, SwfdecAsContext))
-#define SWFDEC_AS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AS_CONTEXT, SwfdecAsContextClass))
-#define SWFDEC_AS_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AS_CONTEXT, SwfdecAsContextClass))
-
-struct _SwfdecAsContext {
- GObject object;
-
- SwfdecAsContextState state; /* our current state */
- SwfdecAsObject * global; /* the global object or NULL if not initialized yet.
- In SwfdecPlayer is NULL unless a sandbox is in use */
- GRand * rand; /* random number generator */
- GTimeVal start_time; /* time this movie started (for GetTime action) */
-
- /* GC properties */
- gsize memory_until_gc;/* amount of memory allocations that trigger a GC */
-
- /* bookkeeping for GC */
- gsize memory; /* total memory currently in use */
- gsize memory_since_gc;/* memory allocated since last GC run */
- GHashTable * strings; /* string=>memory mapping the context manages */
- GHashTable * objects; /* all objects the context manages */
-
- /* execution state */
- unsigned int version; /* currently active version */
- unsigned int call_depth; /* current depth of call stack (equals length of frame list) */
- SwfdecAsFrame * frame; /* topmost stack frame */
- SwfdecAsFrame * last_frame; /* last frame before calling context_run */
- gboolean exception; /* whether we are throwing an exception */
- SwfdecAsValue exception_value; /* value of the exception being thrown, can be anything including undefined */
-
- /* stack */
- SwfdecAsValue * base; /* stack base */
- SwfdecAsValue * end; /* end of stack */
- SwfdecAsValue * cur; /* pointer to current top of stack */
- SwfdecAsStack * stack; /* current stack */
-
- /* magic objects - initialized during swfdec_as_context_startup() */
- SwfdecAsObject *