META_FUNCTION( sn3_bf_write, GetBasePointer ) { UsesLua(); Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) ); sn3_bf_write *buf = GET_META( 1, sn3_bf_write ); PUSH_META( buf->GetBasePointer(), UCHARPTR ); return 1; }
META_FUNCTION( dataFragments_t, GetBuffer ) { UsesLua(); Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) ); dataFragments_t *fragments = GET_META( 1, dataFragments_t ); PUSH_META( fragments->buffer, UCHARPTR ); return 1; }
META_FUNCTION( dataFragments_t, GetFileHandle ) { UsesLua(); Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) ); dataFragments_t *fragments = GET_META( 1, dataFragments_t ); PUSH_META( fragments->hfile, FileHandle_t ); return 1; }
META_FUNCTION( INetworkStringTableContainer, FindTable ) { UsesLua(); Lua()->CheckType( 1, GET_META_ID( INetworkStringTableContainer ) ); Lua()->CheckType( 2, GLua::TYPE_STRING ); INetworkStringTableContainer *pContainer = GET_META( 1, INetworkStringTableContainer ); PUSH_META( pContainer->FindTable( Lua()->GetString( 2 ) ), INetworkStringTable ); return 1; }
META_FUNCTION( INetworkStringTableContainer, GetTable ) { UsesLua(); //Lua()->SetGlobal( "META_ID" , (double)GET_META_ID( INetworkStringTableContainer ) ); Lua()->CheckType( 1, GET_META_ID( INetworkStringTableContainer ) ); Lua()->CheckType( 2, GLua::TYPE_NUMBER ); INetworkStringTableContainer *pContainer = GET_META( 1, INetworkStringTableContainer ); PUSH_META( pContainer->GetTable( Lua()->GetInteger( 2 ) ), INetworkStringTable ); return 1; }
static int vlclua_input_metas_internal( lua_State *L, input_item_t *p_item ) { if( !p_item ) { lua_pushnil( L ); return 1; } lua_newtable( L ); char *psz_name; const char *psz_meta; psz_name = input_item_GetName( p_item ); lua_pushstring( L, psz_name ); lua_setfield( L, -2, "filename" ); free( psz_name ); #define PUSH_META( n, m ) \ psz_meta = vlc_meta_Get( p_item->p_meta, vlc_meta_ ## n ); \ lua_pushstring( L, psz_meta ); \ lua_setfield( L, -2, m ) vlc_mutex_lock(&p_item->lock); if (p_item->p_meta) { PUSH_META( Title, "title" ); PUSH_META( Artist, "artist" ); PUSH_META( Genre, "genre" ); PUSH_META( Copyright, "copyright" ); PUSH_META( Album, "album" ); PUSH_META( TrackNumber, "track_number" ); PUSH_META( Description, "description" ); PUSH_META( Rating, "rating" ); PUSH_META( Date, "date" ); PUSH_META( Setting, "setting" ); PUSH_META( URL, "url" ); PUSH_META( Language, "language" ); PUSH_META( NowPlaying, "now_playing" ); PUSH_META( Publisher, "publisher" ); PUSH_META( EncodedBy, "encoded_by" ); PUSH_META( ArtworkURL, "artwork_url" ); PUSH_META( TrackID, "track_id" ); PUSH_META( TrackTotal, "track_total" ); PUSH_META( Director, "director" ); PUSH_META( Season, "season" ); PUSH_META( Episode, "episode" ); PUSH_META( ShowName, "show_name" ); PUSH_META( Actors, "actors" ); #undef PUSH_META char **names = vlc_meta_CopyExtraNames(p_item->p_meta); for(int i = 0; names[i]; i++) { const char *meta = vlc_meta_GetExtra(p_item->p_meta, names[i]); lua_pushstring( L, meta ); lua_setfield( L, -2, names[i] ); free(names[i]); } free(names); } vlc_mutex_unlock(&p_item->lock); return 1; }