[cvs-annodex] commit (/annodex):
phpannodex/trunk/phpsrc/Classes/Annodex.php
phpannodex/trunk/src/phpanx_general.c
phpannodex/trunk/src/phpanx_general.h
ctford
nobody at lists.annodex.net
Mon Jan 9 11:23:23 EST 2006
Update of /annodex (new revision 1757)
Modified files:
phpannodex/trunk/phpsrc/Classes/Annodex.php
phpannodex/trunk/src/phpanx_general.c
phpannodex/trunk/src/phpanx_general.h
Log Message:
Added a whole bunch of anx_general.h functions as methods to the Annodex class.
Modified: phpannodex/trunk/phpsrc/Classes/Annodex.php
===================================================================
--- phpannodex/trunk/phpsrc/Classes/Annodex.php 2006-01-06 04:32:55 UTC (rev 1756)
+++ phpannodex/trunk/phpsrc/Classes/Annodex.php 2006-01-09 00:23:23 UTC (rev 1757)
@@ -10,6 +10,7 @@
private $anx_handle;
+ /* Methods specific to the php wrapping */
public function __construct( $type = ANX_WRITE, $filename = NULL ) {
if( $type != self::READ && $type != self::WRITE ) {
@@ -33,6 +34,33 @@
public function get_anx_handle() {
return $this->anx_handle;
}
+
+ /* libannodex methods */
+ public static function parse_time( $str ) {
+ return anx_parse_time( $str );
+ }
+ public function last_error() {
+ return anx_last_error( $this->get_anx_handle() );
+ }
+ public function strerror() {
+ return anx_strerror( $this->get_anx_handle() );
+ }
+ public function flush() {
+ return anx_flush( $this->get_anx_handle() );
+ }
+ public function close() {
+ anx_close( $this->get_anx_handle );
+ return;
+ }
+ public function destroy() {
+ return anx_destroy( $this->get_anx_handle() );
+ }
+ public function ready() {
+ return anx_ready( $this->get_anx_handle() );
+ }
+ public function eos() {
+ return anx_eos( $this->get_anx_handle() );
+ }
public function get_presentation_time() {
return anx_get_presentation_time( $this->get_anx_handle() );
}
@@ -45,12 +73,12 @@
public function get_duration() {
return anx_get_duration( $this->get_anx_handle() );
}
- public function close() {
-
- anx_close( $this->get_anx_handle );
- return;
-
+ public function tell_time() {
+ return anx_tell_time( $this->get_anx_handle() );
}
+ public function seek_time() {
+ return anx_seek_time( $this->get_anx_handle() );
+ }
}
Modified: phpannodex/trunk/src/phpanx_general.c
===================================================================
--- phpannodex/trunk/src/phpanx_general.c 2006-01-06 04:32:55 UTC (rev 1756)
+++ phpannodex/trunk/src/phpanx_general.c 2006-01-09 00:23:23 UTC (rev 1757)
@@ -2,6 +2,27 @@
#include "phpanx_util.h"
#include "phpanx_general.h"
+PHP_FUNCTION(anx_parse_time)
+{
+ ANNODEX *anx;
+ int result, str_length;
+ char* str;
+ zval* anx_resource;
+
+ /* Process arguments */
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
+ &str, &str_length) == FAILURE) {
+ RETURN_NULL();
+ }
+ ZEND_FETCH_RESOURCE( anx, ANNODEX*, &anx_resource, -1,
+ LE_ANX_HANDLE_NAME, le_anx_handle);
+
+ /* Call Annodex function */
+ result = anx_parse_time( str );
+
+ RETURN_LONG(result);
+}
+
PHP_FUNCTION(anx_last_error)
{
ANNODEX *anx;
@@ -97,6 +118,31 @@
RETURN_RESOURCE( resource_id );
}
+PHP_FUNCTION(anx_flush)
+{
+ zval* anx_resource;
+ ANNODEX *anx = NULL;
+ int result;
+
+ /* Process arguments */
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r",
+ &anx_resource) == FAILURE) {
+ RETURN_NULL();
+ }
+ ZEND_FETCH_RESOURCE( anx, ANNODEX*, &anx_resource, -1,
+ LE_ANX_HANDLE_NAME, le_anx_handle);
+
+ /* Call Annodex function */
+ result = anx_flush( anx );
+
+ if( result == 0 ) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+ }
+
+}
+
PHP_FUNCTION(anx_close)
{
zval *anx_resource, *returned_anx_resource;
@@ -123,6 +169,31 @@
}
+PHP_FUNCTION(anx_destroy)
+{
+ zval* anx_resource;
+ ANNODEX *anx = NULL;
+ int result;
+
+ /* Process arguments */
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r",
+ &anx_resource) == FAILURE) {
+ RETURN_NULL();
+ }
+ ZEND_FETCH_RESOURCE( anx, ANNODEX*, &anx_resource, -1,
+ LE_ANX_HANDLE_NAME, le_anx_handle);
+
+ /* Call Annodex function */
+ result = anx_destroy( anx );
+
+ if( result == 0 ) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+ }
+
+}
+
PHP_FUNCTION(anx_ready)
{
ANNODEX *anx;
@@ -143,6 +214,26 @@
RETURN_BOOL( is_ready );
}
+PHP_FUNCTION(anx_eos)
+{
+ ANNODEX *anx;
+ int result;
+ zval *anx_resource;
+
+ /* Process arguments */
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r",
+ &anx_resource) == FAILURE) {
+ RETURN_NULL();
+ }
+ ZEND_FETCH_RESOURCE( anx, ANNODEX*, &anx_resource, -1,
+ LE_ANX_HANDLE_NAME, le_anx_handle);
+
+ /* Call Annodex function */
+ result = anx_eos( anx );
+
+ RETURN_BOOL( result );
+}
+
PHP_FUNCTION(anx_set_head)
{
ANNODEX *anx;
@@ -246,3 +337,44 @@
RETURN_DOUBLE( duration );
}
+
+PHP_FUNCTION(anx_tell_time)
+{
+ ANNODEX *anx;
+ double offset;
+ zval *anx_resource;
+
+ /* Process arguments */
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r",
+ &anx_resource) == FAILURE) {
+ RETURN_NULL();
+ }
+ ZEND_FETCH_RESOURCE( anx, ANNODEX*, &anx_resource, -1,
+ LE_ANX_HANDLE_NAME, le_anx_handle);
+
+ /* Call Annodex function */
+ offset = anx_tell_time( anx );
+
+ RETURN_DOUBLE( offset );
+}
+
+PHP_FUNCTION(anx_seek_time)
+{
+ ANNODEX *anx;
+ int whence;
+ double seconds, result;
+ zval *anx_resource;
+
+ /* Process arguments */
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rdl",
+ &anx_resource, &seconds, &whence) == FAILURE) {
+ RETURN_NULL();
+ }
+ ZEND_FETCH_RESOURCE( anx, ANNODEX*, &anx_resource, -1,
+ LE_ANX_HANDLE_NAME, le_anx_handle);
+
+ /* Call Annodex function */
+ result = anx_seek_time( anx, seconds, whence );
+
+ RETURN_DOUBLE( result );
+}
Modified: phpannodex/trunk/src/phpanx_general.h
===================================================================
--- phpannodex/trunk/src/phpanx_general.h 2006-01-06 04:32:55 UTC (rev 1756)
+++ phpannodex/trunk/src/phpanx_general.h 2006-01-09 00:23:23 UTC (rev 1757)
@@ -2,29 +2,39 @@
#define PHPANX_GENERAL_H 1
#define PHPANX_GENERAL_FUNCTIONS \
+ PHP_FE(anx_parse_time, NULL) \
PHP_FE(anx_last_error, NULL) \
PHP_FE(anx_strerror, NULL) \
PHP_FE(anx_open, NULL) \
PHP_FE(anx_new, NULL) \
+ PHP_FE(anx_flush, NULL) \
PHP_FE(anx_close, NULL) \
+ PHP_FE(anx_destroy, NULL) \
PHP_FE(anx_ready, NULL) \
PHP_FE(anx_set_head, NULL) \
PHP_FE(anx_get_basetime, NULL) \
PHP_FE(anx_get_presentation_time, NULL) \
PHP_FE(anx_get_bitrate, NULL) \
PHP_FE(anx_get_duration, NULL) \
+ PHP_FUNCTION(anx_tell_time) \
+ PHP_FE(anx_seek_time, NULL) \
+PHP_FUNCTION(anx_parse_time);
PHP_FUNCTION(anx_last_error);
PHP_FUNCTION(anx_strerror);
PHP_FUNCTION(anx_open);
PHP_FUNCTION(anx_new);
+PHP_FUNCTION(anx_flush);
PHP_FUNCTION(anx_close);
+PHP_FUNCTION(anx_destroy);
PHP_FUNCTION(anx_ready);
PHP_FUNCTION(anx_set_head);
PHP_FUNCTION(anx_get_presentation_time);
PHP_FUNCTION(anx_get_basetime);
PHP_FUNCTION(anx_get_bitrate);
PHP_FUNCTION(anx_get_duration);
+PHP_FUNCTION(anx_tell_time);
+PHP_FUNCTION(anx_seek_time);
#endif
--
ctford
More information about the cvs-annodex
mailing list