Permalink
Browse files

Move from_utf8 function into mlt_properties; remove mlt_util.

  • Loading branch information...
1 parent d04b9eb commit a457e4289821ae71d0cc43f35a0e74e7ab2bf157 @ddennedy ddennedy committed May 19, 2014
View
@@ -48,8 +48,7 @@ OBJS = mlt_frame.o \
mlt_profile.o \
mlt_log.o \
mlt_cache.o \
- mlt_animation.o \
- mlt_util.o
+ mlt_animation.o
INCS = mlt_consumer.h \
mlt_version.h \
@@ -77,8 +76,7 @@ INCS = mlt_consumer.h \
mlt_profile.h \
mlt_log.h \
mlt_cache.h \
- mlt_animation.h \
- mlt_util.h
+ mlt_animation.h
SRCS := $(OBJS:.o=.c)
View
@@ -453,5 +453,5 @@ MLT_0.9.2 {
mlt_playlist_mix_out;
mlt_properties_frames_to_time;
mlt_properties_time_to_frames;
- mlt_util_from_utf8;
+ mlt_properties_from_utf8;
} MLT_0.9.0;
@@ -2513,3 +2513,30 @@ extern mlt_rect mlt_properties_anim_get_rect( mlt_properties self, const char *n
mlt_rect rect = { DBL_MIN, DBL_MIN, DBL_MIN, DBL_MIN, DBL_MIN };
return value == NULL ? rect : mlt_property_anim_get_rect( value, fps, list->locale, position, length );
}
+
+#ifndef WIN32
+
+// See win32/win32.c for win32 implementation.
+
+/** Convert UTF-8 property to the locale-defined encoding.
+ *
+ * MLT uses UTF-8 for strings, but Windows cannot accept UTF-8 for a filename.
+ * Windows uses code pages for the locale encoding.
+ * \public \memberof mlt_properties_s
+ * \param self a properties list
+ * \param name the property to set
+ * \param value the property's new value
+ * \return true if error
+ */
+
+int mlt_properties_from_utf8( mlt_properties properties, const char *prop_name, const char *prop_name_out )
+{
+ // On non-Windows platforms, assume UTF-8 will always work and does not need conversion.
+ // This function just becomes a pass-through operation.
+ // This was largely chosen to prevent adding a libiconv dependency to the framework per policy.
+ // However, for file open operations on Windows, especially when processing XML, a text codec
+ // dependency is hardly avoidable.
+ return mlt_properties_set( properties, prop_name_out, mlt_properties_get( properties, prop_name ) );
+}
+
+#endif
@@ -109,4 +109,5 @@ extern mlt_rect mlt_properties_get_rect( mlt_properties self, const char *name )
extern int mlt_properties_anim_set_rect( mlt_properties self, const char *name, mlt_rect value, int position, int length, mlt_keyframe_type keyframe_type );
extern mlt_rect mlt_properties_anim_get_rect( mlt_properties self, const char *name, int position, int length );
+extern int mlt_properties_from_utf8( mlt_properties properties, const char *name_from, const char *name_to );
#endif
View
@@ -1,36 +0,0 @@
-/**
- * \file mlt_util.c
- * \brief MLT utility functions
- *
- * Copyright (C) 2014 Ushodaya Enterprises Limited
- * \author Dan Dennedy <dan@dennedy.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "mlt_util.h"
-#include "mlt_properties.h"
-
-#ifndef WIN32
-// On non-Windows platforms, assume UTF-8 will always work and does not need conversion.
-// This function just becomes a pass-through operation.
-// This was largely chosen to prevent adding a libiconv dependency to the framework per policy.
-// However, for file open operations on Windows, especially when processing XML, a text codec
-// dependency is hardly avoidable.
-int mlt_util_from_utf8( mlt_properties properties, const char *prop_name, const char *prop_name_out )
-{
- return mlt_properties_set( properties, prop_name_out, mlt_properties_get( properties, prop_name ) );
-}
-#endif
View
@@ -1,40 +0,0 @@
-/**
- * \file mlt_util.h
- * \brief MLT utility functions
- *
- * Copyright (C) 2014 Ushodaya Enterprises Limited
- * \author Dan Dennedy <dan@dennedy.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef MLT_UTIL_H
-#define MLT_UTIL_H
-
-#include "mlt_types.h"
-
-/** Convert UTF-8 string to the locale-defined encoding.
- *
- * MLT uses UTF-8 for strings, but Windows cannot accept UTF-8 for a filename.
- * Windows uses code pages for the locale encoding.
- * \param self a properties list
- * \param name the property to set
- * \param value the property's new value
- * \return true if error
- */
-
-extern int mlt_util_from_utf8( mlt_properties properties, const char *prop_name, const char *prop_name_out );
-
-#endif // MLT_UTIL_H
@@ -28,7 +28,6 @@
#include <framework/mlt_deque.h>
#include <framework/mlt_factory.h>
#include <framework/mlt_cache.h>
-#include <framework/mlt_util.h>
// ffmpeg Header files
#include <libavformat/avformat.h>
@@ -187,7 +186,7 @@ mlt_producer producer_avformat_init( mlt_profile profile, const char *service, c
if ( strcmp( service, "avformat-novalidate" ) )
{
// Open the file
- mlt_util_from_utf8( properties, "resource", "_resource" );
+ mlt_properties_from_utf8( properties, "resource", "_resource" );
if ( producer_open( self, profile, mlt_properties_get( properties, "_resource" ), 1 ) != 0 )
{
// Clean up
@@ -1958,7 +1957,7 @@ static void producer_set_up_video( producer_avformat self, mlt_frame frame )
{
unlock_needed = 1;
pthread_mutex_lock( &self->video_mutex );
- mlt_util_from_utf8( properties, "resource", "_resource" );
+ mlt_properties_from_utf8( properties, "resource", "_resource" );
producer_open( self, mlt_service_profile( MLT_PRODUCER_SERVICE(producer) ),
mlt_properties_get( properties, "_resource" ), 0 );
context = self->video_format;
@@ -2565,7 +2564,7 @@ static void producer_set_up_audio( producer_avformat self, mlt_frame frame )
// Reopen the file if necessary
if ( !context && self->audio_index > -1 && index > -1 )
{
- mlt_util_from_utf8( properties, "resource", "_resource" );
+ mlt_properties_from_utf8( properties, "resource", "_resource" );
producer_open( self, mlt_service_profile( MLT_PRODUCER_SERVICE(producer) ),
mlt_properties_get( properties, "_resource" ), 1 );
context = self->audio_format;

0 comments on commit a457e42

Please sign in to comment.