Hi,

attached patch USTA output with current clip start time and playlist duration. Two more parameters helps detect global playlist playback and remaining time.

that breaks ABI with previous version so lib number should be incremented.

another issue is older mvcp client will not support status reading from newer version - they will reject to parse USTA output due to increased number of entries.

--
________________________________________
Maksym Veremeyenko
>From 058653f92adbdfe9084a3d6f3fad707fdd6563cf Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <ve...@m1stereo.tv>
Date: Wed, 27 Jun 2012 15:19:09 +0300
Subject: [PATCH] extend USTA output with current clip start time and playlist
 duration

---
 src/melted/melted_unit.c |    2 ++
 src/mvcp/mvcp_status.c   |   14 +++++++++++---
 src/mvcp/mvcp_status.h   |    2 ++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/melted/melted_unit.c b/src/melted/melted_unit.c
index 66dfd9c..e4561dd 100644
--- a/src/melted/melted_unit.c
+++ b/src/melted/melted_unit.c
@@ -576,6 +576,8 @@ int melted_unit_get_status( melted_unit unit, mvcp_status status )
 			status->tail_length = mlt_producer_get_length( clip );
 			status->clip_index = mlt_playlist_current_clip( playlist );
 			status->seek_flag = 1;
+			status->dur = mlt_producer_get_length( producer );
+			status->start = info.start;
 		}
 
 		status->generation = mlt_properties_get_int( properties, "generation" );
diff --git a/src/mvcp/mvcp_status.c b/src/mvcp/mvcp_status.c
index 209290f..9c73151 100644
--- a/src/mvcp/mvcp_status.c
+++ b/src/mvcp/mvcp_status.c
@@ -34,7 +34,8 @@
 void mvcp_status_parse( mvcp_status status, char *text )
 {
 	mvcp_tokeniser tokeniser = mvcp_tokeniser_init( );
-	if ( mvcp_tokeniser_parse_new( tokeniser, text, " " ) == 17 )
+	int r = mvcp_tokeniser_parse_new( tokeniser, text, " " );
+	if ( 19 == r || 17 == r )
 	{
 		status->unit = atoi( mvcp_tokeniser_get_string( tokeniser, 0 ) );
 		strncpy( status->clip, mvcp_util_strip( mvcp_tokeniser_get_string( tokeniser, 2 ), '\"' ), sizeof( status->clip ) );
@@ -53,6 +54,11 @@ void mvcp_status_parse( mvcp_status status, char *text )
 		status->seek_flag = atoi( mvcp_tokeniser_get_string( tokeniser, 14 ) );
 		status->generation = atoi( mvcp_tokeniser_get_string( tokeniser, 15 ) );
 		status->clip_index = atoi( mvcp_tokeniser_get_string( tokeniser, 16 ) );
+		if ( 19 == r )
+		{
+			status->start = atoi( mvcp_tokeniser_get_string( tokeniser, 17 ) );
+			status->dur = atoi( mvcp_tokeniser_get_string( tokeniser, 18 ) );
+		};
 
 		if ( !strcmp( mvcp_tokeniser_get_string( tokeniser, 1 ), "unknown" ) )
 			status->status = unit_unknown;
@@ -121,7 +127,7 @@ char *mvcp_status_serialise( mvcp_status status, char *text, int length )
 			break;
 	}
 
-	snprintf( text, length, "%d %s \"%s\" %d %d %.2f %d %d %d \"%s\" %d %d %d %d %d %d %d\r\n",
+	snprintf( text, length, "%d %s \"%s\" %d %d %.2f %d %d %d \"%s\" %d %d %d %d %d %d %d %d %d\r\n",
 							status->unit,
 							status_string,
 							status->clip,
@@ -138,7 +144,9 @@ char *mvcp_status_serialise( mvcp_status status, char *text, int length )
 							status->tail_length,
 							status->seek_flag,
 							status->generation,
-							status->clip_index );
+							status->clip_index,
+							status->start,
+							status->dur );
 
 	return text;
 }
diff --git a/src/mvcp/mvcp_status.h b/src/mvcp/mvcp_status.h
index c629473..c9128f7 100644
--- a/src/mvcp/mvcp_status.h
+++ b/src/mvcp/mvcp_status.h
@@ -67,6 +67,8 @@ typedef struct
 	int generation;
 	int clip_index;
 	int dummy;
+	int dur;	/**< duration of playlist */
+	int start;	/**< time head clip relative to the beginning of the playlist */
 }
 *mvcp_status, mvcp_status_t;
 
-- 
1.7.4.4

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to